swiftMailer does not send mail...

By Djulia - August 5, 2016

Hi,

I have a problem with SwiftMailer. Impossible to send with the option PHP Mail().

The function works again if I modify SimpleMailInvoker.php (line 34):

if (!ini_get('safe_mode')) {
  return @mail($to, $subject, $body, $headers, $extraParams);
}

to

if (!ini_get('safe_mode')) {
   return @mail($to, $subject, $body, $headers);
}

$headers seems to be the origin.

Do you have an idea?

Thanks!

Djulia

By gregThomas - August 5, 2016

Hey Djulia, 

I've not seen this issue before, what error message are you receiving when the message is sent? 

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Djulia - August 5, 2016 - edited: August 5, 2016

Hi Greg,

There is no error message. But the message is not sent.

This post helped me to find the origin :
http://stackoverflow.com/questions/10617552/swiftmailer-does-not-send-mail-why

I am on a new server, I think as it is related to the configuration of this server and safe_mode.

Thanks!

Djulia

By gregThomas - August 5, 2016

Thanks for the extra details. I'd recommend creating a test script that uses the PHP mail function to send an email directly to yourself:

<?php
// the message
$msg = "First line of text\nSecond line of text";
// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);
// send email
mail("your@email.com","My subject",$msg);?>

You'll need to replace your@email.com with your own email address in the script above. 

If you don't receive the test message after running the script, it's likely that there is an issue with the server itself.

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Djulia - August 5, 2016

In fact, the function mail() works correctly on the server. It is a problem only with SwiftMailer.

Thanks, Djulia

By Djulia - August 5, 2016 - edited: August 5, 2016

I think that it is a problem with sendmail_path on server (or sendmail).

This works :

mail('name@domain.com', 'My subject', 'My message...', null, null);

not this :

mail('name@domain.com', 'My subject, 'My message...', null, '-fname@domain.com');

Do you think that it is possible to add NULL for the additional_parameters in cmsB?

Thanks!

Djulia