Forums / Developer / Problem with sending mail attachments

Problem with sending mail attachments

Author Message

Michaƫl Todorovic

Friday 29 October 2010 2:48:56 am

Hello,

In ezpublish 4.2, I was sending emails with attachments to lotus notes and it was working.

Now in ezpublish 4.3, I do the same but attachments are not shown in lotus. I see the email source instead (with mime and base64 encoded attachments). When I send the same email on other mail client (like zimbra or yahoo), attachments are shown correctly.

Here the code I'm using :(from http://ezcomponents.org/docs/api/latest/introduction_Mail.html#sending-a-mail-with-the-composer)

"
  1. <?php
  2. require_once 'tutorial_autoload.php';
  3. // Create a new mail object
  4. $mail = new ezcMail();
  5. // Specify the "from" mail address
  6. $mail->from = new ezcMailAddress( 'sender@example.com', 'Bernard Bernoulli' );
  7. // Add one "to" mail address (multiple can be added)
  8. $mail->addTo( new ezcMailAddress( 'receiver@example.com', 'Wendy' ) );
  9. // Specify the subject of the mail
  10. $mail->subject = "This is the subject of the example mail";
  11. // Create a text part to be added to the mail
  12. $textPart = new ezcMailText( "This is the body of the example mail." );
  13. // Create a file attachment to be added to the mail
  14. $fileAttachment = new ezcMailFile( "~/myfile.jpg" );
  15. // Specify the body of the mail as a multipart-mixed of the text part and the file attachment
  16. $mail->body = new ezcMailMultipartMixed( $textPart, $fileAttachment );
  17. // Create a new MTA transport object
  18. $transport = new ezcMailMtaTransport();
  19. // Use the MTA transport to send the created mail object
  20. $transport->send( $mail );
  21. ?>
"

What can I do ?

Thank you