I am getting a TLS error when trying to mail from PHP. Here is the error: authentication failure [SMTP: STARTTLS failed (code: 220, response: Start TLS negotiation) I am using the sample code in the knowledgebase for the PHP code like this (with appropriate code for username, password, smtp host, etc): This code has been working for years and now all the sudden it is giving an error. The code below was using the default port (25) and I changed it to 587. I have email set up on my cell phone and it uses smtp.hcpawpals.org and port 587 and i can send and receive email on my phone OK. require_once "Mail.php"; $from = "Sender "; $to = "Recipient "; $subject = "This is a test email sent via php"; $body = "This is a test email"; $host = "[Mail Server Name]"; $username = "[email protected]"; $password = "email_password"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => '587', 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body);echo "mail sent"; ?> has there been changes to the way PHP sends email with mail.php? the code to use localhost (email without smtp) works just fine. Code like this: $to = "[email protected]"; $subject = "this is the subject"; $message = "this is the message"; $headers = "From: [email protected]"; if (mail($to, $subject, $message, $headers)) { // mail went OK } else { // mail has errors } Thanks, Warren
I believe you currently have a ticket with us. The issue in your case was a possible wrong password for the email user you're using. Can you try resetting the email password for your email user? https://support.discountasp.net/kb/a1176/how-to-reset-your-email-password-in-the-control-panel_.aspx If you don't have a ticket with us please open one. Provide us with the real SMTP settings on the ticket. https://support.discountasp.net/
Sorry, I thought the forum was not the same as tech support. I can log into the [email protected] email with smartermail and use the same password as in the php code. And I login OK. I have changed the php code to smtp authenticate with a different email address [email protected] and the correct password and it still gets the same error. I can login to smartermail with the same password for [email protected] that I use in the php code and it works just fine. This code was working and had been working for several years. then all of the sudden a few days ago it failed. Don't believe it is a password issue. Here is the php code I am using... $from = "Calendar Info <[email protected]>"; $to = "Warren Smith <[email protected]>"; $subject = "Calendar Pictures Uploaded"; $body = "Calendar Pictures have been uploaded."; $host = "[smtp.hcpawpals.org]"; $port = "587"; $username = "[email protected]"; $password = "*******"; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
I set up debug to look at the smtp tls authentication. Here it is: Seems the TLS is not negotiating properly. DEBUG: Send: EHLO localhost DEBUG: Recv: 250-sm03.internetmailserver.net Hello [96.31.33.35] DEBUG: Recv: 250-SIZE 41943040 DEBUG: Recv: 250-AUTH LOGIN CRAM-MD5 DEBUG: Recv: 250-STARTTLS DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250-DSN DEBUG: Recv: 250 OK DEBUG: Send: STARTTLS DEBUG: Recv: 220 Start TLS negotiation DEBUG: Send: RSET DEBUG: Recv: ecurity failure