How to send Email's through godaddy with PHPMailer? - php

I'm trying for several day send e-mails from my website through godaddy account.
I don't know if there's any special configuration at server side(godaddy)
I don't know if I did any mistake with my php code too.
I really need figure out how can I send email's.
Thanks, Ricardo.
enter code here
try {
//Create a new PHPMailer instance
$mail = new PHPMailer();
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
$mail->DKIM_domain = '**********';
$mail->Debugoutput = 'html';
$mail->Host = "a2plcpnl0321.prod.iad2.secureserver.net";
$mail->Port = 465;
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "***************.com";
//Password to use for SMTP authentication
$mail->Password = "**99KKll";
$mail->SMTPSecure = 'ssl';
//Set who the message is to be sent from
$mail->setFrom('****************.com', '*******');
//Set an alternative reply-to address
//$mail->addReplyTo('replyto#example.com', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('**************.com', '*****');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
$mail->Body = "<i>This is the Link to change your password:</i>";
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
print_r($mail);

are you catching the errors?
try {
// your mail code
// $mail->send();
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}

SERVER -> CLIENT: 220-a2plcpnl0321.prod.iad2.secureserver.net ESMTP Exim 4.85 #2 Fri, 26 Feb 2016 16:15:57 -0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO warneracademy.com
SERVER -> CLIENT: 250-a2plcpnl0321.prod.iad2.secureserver.net Hello a2plcpnl0321.prod.iad2.secureserver.net [*************]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250 HELP
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5hbWU6
CLIENT -> SERVER: cmVxdWVzdEB3YXJuZXJhY2FkZW15LmNvbQ==
SERVER -> CLIENT: 334 UGFzc3dvcmQ6
CLIENT -> SERVER: Kio5OUtLbGw=
SERVER -> CLIENT: 235 Authentication succeeded
CLIENT -> SERVER: MAIL FROM:<**************>
SERVER -> CLIENT: 250 OK
CLIENT -> SERVER: RCPT TO:<*************>
SERVER -> CLIENT: 250 Accepted
CLIENT -> SERVER: DATA
SERVER -> CLIENT: 354 Enter message, ending with "." on a line by itself
CLIENT -> SERVER: Date: Fri, 26 Feb 2016 23:15:52 +0000
CLIENT -> SERVER: To: Ricardo Scarpim <**************>
CLIENT -> SERVER: From: WarnerAcademy <**************>
CLIENT -> SERVER: Subject: PHPMailer SMTP test
CLIENT -> SERVER: Message-ID: <5fa4a06963e0e5c2e64a8e88e553bc10#warneracademy.com>
CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.13 (https://github.com/PHPMailer/PHPMailer)
CLIENT -> SERVER: MIME-Version: 1.0
CLIENT -> SERVER: Content-Type: multipart/alternative;
CLIENT -> SERVER: boundary="b1_5fa4a06963e0e5c2e64a8e88e553bc10"
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
CLIENT -> SERVER:
CLIENT -> SERVER: This is a multi-part message in MIME format.
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10
CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: This is a plain-text message body
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10
CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
CLIENT -> SERVER:
CLIENT -> SERVER: <i>This is the Link to change your password:</i>
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER:
CLIENT -> SERVER: --b1_5fa4a06963e0e5c2e64a8e88e553bc10--
CLIENT -> SERVER:
CLIENT -> SERVER: .
SERVER -> CLIENT: 250 OK id=1aZRc5-001CJG-Tk
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 a2plcpnl0321.prod.iad2.secureserver.net closing connection
Message sent!

after many attemps.. this works for me in Godaddy[20/12/2017]
require 'PHPMailerAutoload.php';
$mail = new PHPMailer();
//$mail->isSMTP();
//isSMTP seems to be the problem.. because it sends locally
$mail->SMTPDebug = 0;
//$mail->DKIM_domain = '127.0.0.1';
$mail->Host = "localhost";
$mail->Port = "25";
$mail->SMTPSecure = "none";
$mail->SMTPAuth = false;
$mail->Username = "";
$mail->Password = "";

I know this isn't exactly the solution the original post was looking for, but for anyone who is dealing with the limitations of sending emails through GoDaddy or any other hosting service, this could be a useful workaround. This solution will allow you to send emails via Gmail from any other account you have login credentials for.
Requirements:
Gmail account, XAMPP or similar local web server, PHPMailer library
(tutorials on how to use XAMPP and PHPMailer are abundantly available online)
Instructions:
1. Go to "Settings" in your Gmail account. Under "Accounts and Import," add "youraccount#domainyouown.com" in the "Send Mail As" section.
2. In your PHP script (using the PHPMailer library), replace the credentials in the following lines of code with your Gmail credentials and the account you'd like to send from:
$mail->Username = 'username#gmail.com';
$mail->Password = 'yourpassword';
$mail->setFrom('youraccount#domainyouown.com', 'Your Name');
$mail->addReplyTo('youraccount#domainyouown.com', 'Your Name');
Added benefits of this method:
Emails are authenticated. I spent quite a while trying to achieve this via GoDaddy, to no avail. This removes the "possible spam" notification that is sometimes present with emails sent through hosting server relays...
Emails are sent faster. For whatever reason, the emails I sent via GoDaddy using PHP's mail() function took a few minutes to go through. Gmail takes seconds.
Copies of the emails you send actually show up in your Gmail "Sent" folder. This was also something that I could not achieve via GoDaddy, and I was told by customer support that this is a limitation of the service.
Feel free to correct me if I'm wrong on any of this or suggest a better method. It's just the most elegant solution I've found so far!

Related

Error: SMTP Error: Could not authenticate [duplicate]

I created an account on Gmail (becase the previous one was giving me the same problem) so that my application could send emails using google smtp server.
I'm using the PHPMailer library and asked it to show any log errors.
I always get a message similar to this. It vary a little, sometimes it is shorter and sometimes longer, depending on my configuration
2015-08-01 05:07:01 CLIENT -> SERVER: EHLO www.lavile.com
2015-08-01 05:07:01 CLIENT -> SERVER: AUTH LOGIN
2015-08-01 05:07:01 CLIENT -> SERVER: Y29udGF0by5sYXZpbGVAZ21haWwuY29t
2015-08-01 05:07:01 CLIENT -> SERVER: WXlhdUgxMnM= 2015-08-01 05:07:01 SMTP ERROR: Password command failed: 534-5.7.9 Please log in with your web browser and then try again. Learn more at 534 5.7.9 https://support.google.com/mail/answer/78754 b16sm3352387qga.48 - gsmtp
2015-08-01 05:07:01 SMTP Error: Could not authenticate.
2015-08-01 05:07:01 CLIENT -> SERVER: QUIT
2015-08-01 05:07:01 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting string(82) "SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting"
This is my script
$mail->Username = "myusername#gmail.com";
$mail->Password = "mypassword";
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->SetFrom($mail->Username, 'Contato Lavile');
$mail->addAddress($mail->Username, "Contato Lavile");
$mail->Subject = 'Novo contato no site Lavile';
$mail->Body = $text;
$mail->IsHTML(true);
$mail->AltBody = $text;
Also GMAIL is sending automatic emails to myself alerting me that a new login attempt was blocked. I even changed some settings on my gmail to make it work but everything failed
Any idead? Do you know what could be happening?
I would recommend to actually read the error message:
... 534-5.7.9 Please log in with your web browser and then try again. Learn more at 534 5.7.9 https://support.google.com/mail/answer/78754 b16sm3352387qga.48 - gsmtp
When reading this site you will find something about supporting client which provide only less secure methods of authorization. Your client is one of these so follow the link to learn how to enable support for these application in gmail.
You can send email without own smtp server:
1) get recipient mx hostname from dns
2) send email to port 25
Not saying this is necessarily what happened to the topic opener but I had exactly this same error today. And the reason I got it was because I created a new e-mail address and you first need to log in to Gmail via the browser once before you can use smtp.
After logging in to the Gmail web client via the browser and going over the initial flow I was able to send via the smtp endpoint.
$mail->Host = "smtp.gmail.com"; should be something like:
$mail->Host = "mail.yourdomain.com";//replace your domain name

problem with PHPMAILER Could not connect to SMTP host

I Have Problem With PHPMAILER it's Work Good in localhost but in server give me error
PHPMAILER Code
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
function sendMail($driver, $driverUser){
// Load Composer's autoloader
require 'vendor/autoload.php';
// Instantiation and passing `true` enables exceptions
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'wastaapplication#gmail.com'; // SMTP username
$mail->Password = '*******'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
//Recipients
$mail->setFrom('wastaapplication#gmail.com', 'Wasta Driver');
$mail->addAddress($driver, $driverUser); // Add a recipient
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'New Order';
$mail->Body = ' مرحبا ' . '<strong>' . $driverUser . '</strong>' . ' لديك طلبيه جديده برجاء مراجعه برنامج الطيارين ';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}
}
Error
2019-04-30 05:14:51 SERVER -> CLIENT: 220-server.issgroups.org ESMTP Exim 4.91 #1 Tue, 30 Apr 2019 07:14:51 +0200 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
2019-04-30 05:14:51 CLIENT -> SERVER: EHLO wastetkheer.com
2019-04-30 05:14:51 SERVER -> CLIENT: 250-server.issgroups.org Hello wastetkheer.com [138.201.107.252]250-SIZE 52428800250-8BITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
2019-04-30 05:14:51 CLIENT -> SERVER: STARTTLS
2019-04-30 05:14:51 SERVER -> CLIENT: 220 TLS go ahead
SMTP Error: Could not connect to SMTP host.
2019-04-30 05:14:51 CLIENT -> SERVER: QUIT
2019-04-30 05:14:51
2019-04-30 05:14:51
SMTP Error: Could not connect to SMTP host.
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host.
i'm trying change SMTPDebug To 1
& //$mail->isSMTP();
it's work good in local host not in server
I guess the problem is with the SMTP authentication, but I couldn´t find the problem.
Please search before posting as this has been answered many times before.
It's failing immediately after STARTTLS, indicating a TLS error. This is very common with gmail because their CA root certificates changed about a year ago to ones that are not present in many older OSs. It's working for you on localhost because your local OS does not have outdated CA certificates.
Read the troubleshooting guide which tells you exactly how to deal with this.
It could also be down to your ISP redirecting SMTP traffic to their own mail server, causing a certificate name mismatch - the guide provides ways of diagnosing the exact problem.

How to send email with smtp.office365 using PHPMailer

I'm using code below to send mail but I get Authentication unsuccessful. The same code works with smtp.gmail.com, but not with smtp.office365.com.
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 4;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'tls://smtp.office365.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "anonymized#anonymized.com.br";
//Password to use for SMTP authentication
$mail->Password = "anonymized";
//Set who the message is to be sent from
$mail->setFrom('anonymized#anonymized.com.br', 'First Last');
//Set an alternative reply-to address
$mail->addReplyTo('anonymized#anonymized.com.br', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('anonymized#anonymized.com.br', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
I get the following output:
2017-06-06 18:24:34 SERVER -> CLIENT: 220 FR1PR80CA0087.outlook.office365.com Microsoft ESMTP MAIL Service ready at Tue, 6 Jun 2017 18:24:25 +0000
2017-06-06 18:24:34 CLIENT -> SERVER: EHLO desenv
2017-06-06 18:24:34 SERVER -> CLIENT: 250-FR1PR80CA0087.outlook.office365.com Hello [201.47.213.100]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-STARTTLS250-8BITMIME250-BINARYMIME250 CHUNKING
2017-06-06 18:24:34 CLIENT -> SERVER: STARTTLS
2017-06-06 18:24:34 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2017-06-06 18:24:35 CLIENT -> SERVER: EHLO desenv
2017-06-06 18:24:35 SERVER -> CLIENT: 250-FR1PR80CA0087.outlook.office365.com Hello [201.47.213.100]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN250-8BITMIME250-BINARYMIME250 CHUNKING
2017-06-06 18:24:35 CLIENT -> SERVER: AUTH LOGIN
2017-06-06 18:24:35 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-06-06 18:24:35 CLIENT -> SERVER: xxx
2017-06-06 18:24:35 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2017-06-06 18:24:35 CLIENT -> SERVER: xxx
2017-06-06 18:24:40 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [FR1PR80CA0087.lamprd80.prod.outlook.com]
2017-06-06 18:24:40 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [FR1PR80CA0087.lamprd80.prod.outlook.com]
SMTP Error: Could not authenticate.
2017-06-06 18:24:40 CLIENT -> SERVER: QUIT
2017-06-06 18:24:40 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
I tried many things. Changing file encoding because in this question smtplib.SMTPAuthenticationError: (535, '5.7.3 Authentication unsuccessful') the problem was the encoding of the password.
I tried using this, as in PHPMailer Authentication unsuccessful:
$mail->SMTPAuth = False;
But I got:
2017-06-06 18:28:59 SERVER -> CLIENT: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM]
2017-06-06 18:28:59 SMTP ERROR: MAIL FROM command failed: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM]
The following From address failed: rrjuridico#grupopetropolis.com.br : MAIL FROM command failed,5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM],530,SMTP server error: MAIL FROM command failed Detail: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM] SMTP code: 530
Mailer Error: The following From address failed: rrjuridico#grupopetropolis.com.br : MAIL FROM command failed,5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM] ,530,SMTP server error: MAIL FROM command failed Detail: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM] SMTP code: 530SMTP server error: MAIL FROM command failed Detail: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [RO1P215CA0017.LAMP215.PROD.OUTLOOK.COM] SMTP code: 5302017-06-06 18:28:59 CLIENT -> SERVER: QUIT
2017-06-06 18:28:59 SERVER -> CLIENT:
2017-06-06 18:28:59 SMTP ERROR: QUIT command failed:
I tried removing line below:
$mail->isSMTP();
I got Message sent!, but email wasn't sent.
Any Idea, any help would be very much apreciated.
It just looks like you have the wrong ID and password. They were easily decoded from the SMTP transcript (I have removed them - you might want to change your PW now), but your password only contained ASCII characters, so it's not an encoding problem.
You do need to authenticate in order to send on most systems, so your second example makes sense.
Not calling isSMTP() means that it defaults to using mail(), which relays your message via a local mail server; the local delivery may succeed, but the onward delivery many still fail - this matches what you're seeing. To check that, look in your mail server log (usually /var/log/mail.log or nearby).

Can't send email with php using gmail - Authorising error

I'm new to PHP and trying to build a website with registration form. Users should receive an email with a confirmation link (since I have a free hosting server I am trying to use gmail server). The thing is I'm struggling with the email php code. I am trying to use PHPMailer functions as follows:
<?php
/**
* This example shows settings to use when sending via Google's Gmail servers.
*/
//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');
require 'PHPMailer/PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
// use
// $mail->Host = gethostbyname('smtp.gmail.com');
// if your network does not support SMTP over IPv6
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 587;
//Set the encryption system to use - ssl (deprecated) or tls
$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "MYEMAIL#gmail.com";
//Password to use for SMTP authentication
$mail->Password = "MYPASSWORD";
//Set who the message is to be sent from
$mail->setFrom('example#example.com', 'Name S');
//Set an alternative reply-to address
$mail->addReplyTo('example#example.com', 'Name S');
//Set who the message is to be sent to
$mail->addAddress('email#gmail.com', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer GMail SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML("HELLo");
//Replace the plain text body with one created manually
//$mail->AltBody = 'This is a plain-text message body';
//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
I tried both ports 587 and 465. Also tried both ssl and tls. Every time I try to run the code I get the following error:
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP gw4sm17090153wjc.45 - gsmtp
CLIENT -> SERVER: EHLO spec.dr-manny.co.uk SERVER -> CLIENT:
250-smtp.gmail.com at your service, [185.27.134.36]250-SIZE
35882577250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN
OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250
SMTPUTF8 CLIENT -> SERVER: AUTH LOGIN SERVER -> CLIENT: 334
VXNlcm5hbWU6 CLIENT -> SERVER: bWFubnlzYWVkaUBnbWFpbC5jb20= SERVER ->
CLIENT: 334 UGFzc3dvcmQ6 CLIENT -> SERVER: a2luZ29uZW1vaDk5 SERVER ->
CLIENT: 534-5.7.14
Please log in via your web browser
and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14
https://support.google.com/mail/answer/78754 gw4sm17090153wjc.45 -
gsmtp SMTP ERROR: Password command failed: 534-5.7.14
Please log in via your web browser
and534-5.7.14 then try again.534-5.7.14 Learn more at534 5.7.14
https://support.google.com/mail/answer/78754 gw4sm17090153wjc.45 -
gsmtp SMTP Error: Could not authenticate. CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 2.0.0 closing connection gw4sm17090153wjc.45 -
gsmtp SMTP connect() failed.
Error: SMTP connect() failed.
Also, I got an email from Gmail with the subject "Someone has your password". I opened the email and found this "
Hi Manny,
Someone just used your password to try to sign in to your Google Account MYEMAIL#gmail.com, using an application such as an email client or mobile device."
I received this email about 15 mins after I ran the php page.
I turned off "2-step verification" and turned off "allow less secure apps". Nothing seems to help. Anyone please could help me?
I had the same issue last year: the code (VB.Net) was OK, so where the credentials. The problem was that gmail didn't like that some app in a web server far away (my hosting) where trying o use your same username.
I fixed it (in two different occasions) by:
Logging in gmail once from that server (using remote desktop).
Logging in here https://accounts.google.com/DisplayUnlockCaptcha from my pc to "unlock" remote connections.
After that test your code again.

phpmailer error on from email, PHP email

Ok I've been knocking my head against a wall, more for the overall problem of send an email thru PHP while specifying a mail server...
The solution I've made it the furthest with is phpmailer.
If there is a lightweight VERY easy solution - please suggest it.
here's what I have (obviously the u/p are NOT the real u/p - but they are in my code - the same account I get my gmail from in outlook, settings work FINE there...
Im using it as a test - because the smtp settings the client gave me didn't work - so I though I'd try something that I KNEW - DID work...
<?php
require 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "me#myDomain.com";
$mail->Password = "myPassword";
$mail->SetFrom('me#myDomain.com', 'James Test');
$mail->AddAddress('me#yahoo.com', 'John Doe');
$mail->Subject = 'PHPMailer SMTP test';
$mail->MsgHTML( 'This is a test' );
//Send the message, check for errors
if( !$mail -> Send() ) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
The error I'm getting
SMTP -> FROM SERVER:
CLIENT -> SMTP: EHLO dev.nps.com
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
CLIENT -> SMTP: HELO dev.nps.com
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
CLIENT -> SMTP: AUTH LOGIN
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connected
The following From address failed: me#myDomain.com : Called Mail() without being connected
Mailer Error: The following From address failed: me#myDomain.com : Called Mail() without being connected
The dev.nps.com is simply a 'fake' domain I put in my host file, so i can distinguish my projects and not use 127.0.0.1 for everything... it's not specified in the code - so I'm not sure what's going on there, but the error seems to balk at the 'from email'... which again is weird because it shouldn't matter
Thanks for any help -

Categories