Hi @Synchro ,
I can able to send mail from gmail.
smtp.gmail.com
587
tls
But not from my own domain
smtp.mydomain.in
587
tls
I have checked all the issues. I didn't answer for my issue
What might be the reason?
Please help & notify me. Thank YOu.
My error here
2017-09-25 06:30:08 SERVER -> CLIENT: 220 outbound.mailhostbox.com ESMTP Postfix 2017-09-25 06:30:08 CLIENT -> SERVER: EHLO localhost 2017-09-25 06:30:08 SERVER -> CLIENT: 250-outbound.mailhostbox.com 250-PIPELINING 250-SIZE 41648128 250-VRFY 250-ETRN 250-STARTTLS 250-AUTH PLAIN LOGIN 250-AUTH=PLAIN LOGIN 250-ENHANCEDSTATUSCODES 250-8BITMIME 250 DSN 2017-09-25 06:30:08 CLIENT -> SERVER: STARTTLS 2017-09-25 06:30:08 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS 2017-09-25 06:30:09 SMTP Error: Could not connect to SMTP host. 2017-09-25 06:30:09 CLIENT -> SERVER: QUIT 2017-09-25 06:30:10 SERVER -> CLIENT: 2017-09-25 06:30:10 SMTP ERROR: QUIT command failed: 2017-09-25 06:30:10 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Message could not be sent.Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
When i put below code, it works fine perfectly
What this below code mean?
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
It means that the TLS certificate provided by your mail server does not match the host name you asked for. In your code you're asking to connect to smtp.mydomain.in, but the server says it's called outbound.mailhostbox.com, and a certificate for one will not match the other. Check that you're using the correct host name. It can also happen if your ISP redirects outbound SMTP traffic to their own server - something which you would not be able to detect without certificate verification.
Setting those options will make it "work", but it does so by turning off verification of the certificate, which may mean that you are vulnerable to man-in-the-middle attacks, and so is unsafe. Figure out exactly why you need to do that.
All of this is covered in the troubleshooting guide.
Thank you so much .... @Synchro
@edukondalu123 Thanks, the code worked for me
@klever34 Really, don't use that code: fix it properly like the guide says. It's like saying that leaving the front door of your house open is a "working" solution to having to remember where your keys are; there are implications to doing that.
Thank you so much .... @Synchro
Thank you so much .... @Synchro
@edukondalu123 thank you. It's work for me.
Most helpful comment
When i put below code, it works fine perfectly
What this below code mean?
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);