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 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

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

Hi Djulia, 

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

You could customize your version of CMS Builder so that it has this parameter in. 

I'll pass this issue on to Dave, I don't think we'd add this fix into the current release of CMS Builder, as the oldest version of PHP it supports is version 5.5 or later, and Safe Mode was removed from version 5.4 of PHP:

http://php.net/manual/en/ini.sect.safe-mode.php#ini.safe-mode

You could also try asking your host to disable PHP Safe Mode to resolve the issue.

Thanks,

Greg

Greg Thomas







PHP Programmer - interactivetools.com