简体   繁体   中英

Laravel SMTP mail not sending

I have two environments set up, let's call one Dev and one QA. Both are remote to my local machine with a laravel we app running. Both are pointing to an SMTP server to send email. One (dev) works and one (QA) doesn't, but neither throw an error message.

Here is my mail.php configuration (names changed for genericness):

return array(

'driver' => 'smtp',
'host' => 'cereal.andmilk.com',
'port' => 25,
'from' => array('address' => 'order@cereal.com', 'name' => 'Cereal is Good'),
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false,

);

At first I thought that sendmail could be the problem, as it doesn't exist on either QA or Dev, but that doesn't really help as Dev has no trouble sending emails. I'm guessing that it only has to exist on the actual smtp server, in this case 'cereal.andmilk.com'.

One potential solution I found was to whitelist/open the smtp server URL and port. The methods I discovered to do that seemed to require root access, which I don't currently have on QA. I am continuing to attempt investigating that line of thought, but in the meantime, is there any other troubleshooting I can do on this issue?

Laravel is version 4.2.

If your server is not https then you need to add this code to your mail.php file

'stream' => [
   'ssl' => [
      'allow_self_signed' => true,
      'verify_peer' => false,
      'verify_peer_name' => false,
   ],
],

or you can follow this link it will be helpfull for you : how to fix stream_socket_enable_crypto(): SSL operation failed with code 1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM