Author Topic: Email problem with VirtueMart and Joomla - Solution  (Read 12156 times)

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Email problem with VirtueMart and Joomla - Solution
« on: October 30, 2009, 16:18:33 pm »
If you cannot send notification email from VirtueMart, yet Joomla emails work OK, here is the solution:

Search for "vmCreateMail", comment it out and replace with:
//      $mail = vmCreateMail( $from, $fromname, $subject, $body );
        $mail = & JFactory::getMailer();
        $mail->setSender(array($from, $fromname));
        $mail->setSubject($subject);
        $mail->setBody($body);

I know that it is not the nicest possible solution, but after killing 5 hours on this stupid problem I don't care - it WORKS !
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

Yamabushi

  • Guest
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #1 on: November 01, 2009, 16:06:00 pm »
Hello,

Thanks for this solution, I started to give up to make it works :)

Just a little clarification: the file where to do the modification is /administrator/components/com_virtuemart/classes/ps_main.php





demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #2 on: November 01, 2009, 16:23:49 pm »
You are welcome :)

Actually I'm starting to think that even from architectural standpoint this is not such a bad solution. If VirtueMart is always used with Joomla, why reinvent the wheel and reimplement (with bugs !) email client, when there is working one in Joomla.

Any VirtueMart developers here care to comment ?
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

marilynm

  • Beginner
  • *
  • Posts: 14
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #3 on: November 03, 2009, 15:00:50 pm »
Hi everyone,

Can you please tell me how to modify this file with the replacing code you're writing?.

Itried to do it, but after uploading it, the initial screen gets all blank.

Can you give a hand?

Thank you.
Paul.

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #4 on: November 03, 2009, 15:03:52 pm »
Well, the usual routine is to open an editor of your choice, say vi, edit the code and save it :)
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

Bocaj1

  • Beginner
  • *
  • Posts: 10
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #5 on: November 03, 2009, 15:55:38 pm »
Hi demiurg

Did you outcomment the whole function vmCreateMail, vmMail or only the few lines that you show in your post? Can't get it to work...

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #6 on: November 03, 2009, 16:11:55 pm »
I just replaced the call to
      $mail = vmCreateMail( $from, $fromname, $subject, $body );
with
        $mail = & JFactory::getMailer();
        $mail->setSender(array($from, $fromname));
        $mail->setSubject($subject);
        $mail->setBody($body);
in exactly the same way as shown above.

Are you sure that Joomla emails work OK ?
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

marilynm

  • Beginner
  • *
  • Posts: 14
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #7 on: November 03, 2009, 16:29:51 pm »
Hi,

I did exactly what as written, and I still get the initial page blank...

Maybe I missed something...

Here I show you the portion of code of the file I have:

This is the first part:
function vmCreateMail( $from='', $fromname='', $subject='', $body='' ) {
   global $mosConfig_absolute_path, $mosConfig_sendmail;
   global $mosConfig_smtpauth, $mosConfig_smtpuser;
   global $mosConfig_smtppass, $mosConfig_smtphost;
   global $mosConfig_mailfrom, $mosConfig_fromname, $mosConfig_mailer;

And then the other part:

function vmMail($from, $fromname, $recipient, $subject, $body, $Altbody='', $mode=false, $cc=NULL, $bcc=NULL, $images=null, $attachment=null, $replyto=null ) {
   global $mosConfig_debug;

      // Filter from, fromname and subject
   if (!vmValidateEmail( $from ) || !vmValidateName( $fromname ) || !vmValidateName( $subject )) {
      return false;
   }
   
   $mail = vmCreateMail( $from, $fromname, $subject, $body );


Can you help me?
Thank you.
Regards!

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #8 on: November 03, 2009, 16:41:40 pm »
What is your Joomla and VM versions ?

What happens if you just uncomment
$mail = vmCreateMail( $from, $fromname, $subject, $body );
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

marilynm

  • Beginner
  • *
  • Posts: 14
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #9 on: November 03, 2009, 16:46:13 pm »
Hi demiurg,

I don't get "uncomment"... how do I do that? (I'm not a programmer).

VM and Joomla, both the latest versions (1.5.14 and 1.1.4)

Both are working on a Windows 2000 Server under IIS.

Would you like to check the entire file?

Thank you very much.
Regards!

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #10 on: November 03, 2009, 16:50:44 pm »
Adding comment, i.e. "//", before at the beginning of the line uncomments it.

Anyway, I'm pretty sure that the problem is either with your editor or in the way you transfer the file to the web server. What editor are you using and how you transfer the file ?
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

marilynm

  • Beginner
  • *
  • Posts: 14
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #11 on: November 03, 2009, 16:58:14 pm »
Hi,

I use Dreamweaver and I transfer the file via VNC.

You know I tried that and I did replace the code, but when updating the initial page, it gets completely blank.

Remember I'm not a programmer, so I'm not doing this the right way.

Is a large file to paste the code in here.

Would you like me to send you the file?

Thank you.
Regards!


demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #12 on: November 03, 2009, 17:11:52 pm »
I was not aware that it is possible to transfer files via VNC :)

Just use the attached file.

[attachment cleanup by admin]
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.

marilynm

  • Beginner
  • *
  • Posts: 14
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #13 on: November 03, 2009, 17:27:00 pm »
Hi demiurg,

I'm totally frustrated...  >:(

I still get the internal server error when I want to register a new user. It takes a few seconds and the the error shows up.
The weird thing is that the user is created, but it cannot enter the site.

That is exactly what I need. The user registered but unable to enter the site until I approve him according to certain parameters.

When I test everything in my local pc using apache, I have no problem at all. Everything works fine....

Remember that native Joomla E-Mail works fine.

Is there anything else I can try with?

Or just wait for a VM that works with IIS?

Thank you.
Regards!

demiurg

  • Beginner
  • *
  • Posts: 34
    • Fast multi browser screenshots
Re: Email problem with VirtueMart and Joomla - Solution
« Reply #14 on: November 03, 2009, 17:36:57 pm »
 I lost you. Are we talking about emails or user registration ? Blank screen or internal server error ?
BrowserSeal - fast multi browser screenshots
Currently supports Firefox, Internet Explorer (IE6, IE7 and IE8), Chrome, Safari and Opera.
Free trial download available.