?
avatar VampiRUS
VampiRUS
6 May 2015

Steps to reproduce the issue

$mail = JMail::getInstance();
$mail->sendMail($vendorEmail,$vendorName,$email,$subject,$body,true,null,null,$file);
ulink($file);
in some code after
$mailer = JFactory::getMailer();
$mailer->addRecipient( $recipient );
$mailer->setSubject( $subject );
$mailer->setBody( $body );
$mailer->setSender( $sender );
$return = $mailer->Send();

Expected result

got email whith $body content in second email

Actual result

email with empty body

System information (as much as possible)

PHP 5.4.19
Apache/2.4.4 (Win32) OpenSSL/0.9.8y PHP/5.4.19
apache2handler
Joomla! 3.4.1 Stable [ Ember ] 21-March-2015 20:30 GMT
Platform Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

Additional comments

libraries\vendor\phpmailer\phpmailer\class.phpmailer.php in method createBody try to get an attachmet that was in email before and removed and set $body='' on error
adding clearAttachments(); after sending in sendMail will fix problem

avatar VampiRUS VampiRUS - open - 6 May 2015
avatar VampiRUS VampiRUS - change - 6 May 2015
The description was changed
Title
Clear attachment after sending email by JMail::sendMail
To clear attachment after sending email by JMail::sendMail
avatar VampiRUS VampiRUS - change - 6 May 2015
Title
Clear attachment after sending email by JMail::sendMail
To clear attachment after sending email by JMail::sendMail
avatar zero-24 zero-24 - change - 6 May 2015
Category Libraries External Library Libraries
avatar vdespa
vdespa - comment - 24 May 2015

I am afraid I do not exactly follow you. Could you please post a complete example with the code where all the variables (like $body) are defined.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6898.

avatar vdespa vdespa - change - 24 May 2015
Status New Information Required
avatar brianteeman brianteeman - change - 19 Jul 2015
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2015-07-19 18:03:17
Closed_By brianteeman
avatar brianteeman
brianteeman - comment - 19 Jul 2015

After several months without further reply to the request for further information this issue is being closed. It can always be re-opened


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6898.

avatar brianteeman brianteeman - close - 19 Jul 2015
avatar brianteeman brianteeman - close - 19 Jul 2015
avatar webmechanicx
webmechanicx - comment - 7 Aug 2015

It is late but a complete example based on the description above.

            $body = '<html>
    <body>
    <div align="center">simple HTML Email in Joomla</div>
    </body>
    </html>';

    //@set mailing options (to,subject,body etc)
    $mailer->addRecipient($recipient);
    $mailer->setSubject('Booking Gift Voucher for Driving Lesson');
    $mailer->isHTML(true);
    $mailer->Encoding = 'base64';
            $mailer->CharSet = 'UTF-8';
    $mailer->setBody($body);
            $mailer->setSender($sender);
            // Optional file attached
    $mailer->addAttachment('assets/pdf/Voucher-IKTCVPA8S9.pdf');

Hope it helps someone.

Add a Comment

Login with GitHub to post a comment