sending mail using gmail SMTP and OAuth2.0 - zend-framework

I got struck with this error for past 2 days of time. The objective is simple. I tried out sending emails using gmail smtp oauth and zend mailer for this work. I got this error
Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message '5.5.2 Cannot Decode response iv3sm786895pbc.40 - gsmtp ' in /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail/Protocol/Abstract.php:431
Stack trace: #0 /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail/Protocol/Smtp.php(265): Zend_Mail_Protocol_Abstract->_expect(250, 300)
:#1 /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail/Transport/Smtp.php(207): Zend_Mail_Protocol_Smtp->mail('saravanan1115#g...')
:#2 /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
:#3 /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail.php(1194): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
:#4 /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/send.php(292): Zend_Mail->send(Object(Zend_Mail_Transport_Smtp))
:#5 /opt/lampp/htdocs/salaikumar/handmadeimap-mas in /opt/lampp/htdocs/salaikumar/handmadeimap-master/gmailoauthexample/Zend/Mail/Protocol/Abstract.php on line 431
Any one help me out with this? I referred this blog to create a Xoauth.php http://piecewiseinc.blogspot.in/2013/02/send-mail-with-gmail-smtp-and-xoauth.html. I saw a same post about this in over here. But this is dint help out. Problems sending an email to google's SMTP server (with own php script).

Related

Not able to send email notification using Scala in Spark Yarn Cluster mode [duplicate]

I am working with Java Mail API, i am getting this strange error: "Initial Access check failure"
My configuration looks fine, URL, user, pwd, etc. Just cannot figure out why this message comes up.
550 5.7.1 Initial access check failure
DEBUG SMTP: got response code 550, with response: 550 5.7.1 Initial access check failure
RSET
250 2.5.0 Ok.
DEBUG SMTP: MessagingException while sending, THROW:
com.sun.mail.smtp.SMTPSendFailedException: 550 5.7.1 Initial access check failure
;
nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure
at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2133)
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1630)
at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1132)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at com.mrd.utilities.SendMailMessage.sendNewsMobileDeviceAlert(SendMailMessage.java:277)
at DBManager.sendLowVolumeEmailAlert(DBManager.java:241)
at DBManager.executeQuery(DBManager.java:168)
at DBManager.getConnection(DBManager.java:109)
at MainClass.main(MainClass.java:37)
Caused by: com.sun.mail.smtp.SMTPSenderFailedException: 550 5.7.1 Initial access check failure
at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1637)
... 8 more
QUIT
221 2.3.0 Bye received. Goodbye.
I got this issue and resolved it by providing access to my server and sender email id on SMTP server. SMTP servers are restricted as to which server can send email from what sender email id. Contact with your SMTP administrator have them grant permission to your server ip and sender email id.

com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied

I am trying since yesterday but no luck. I am getting this weird error message which doesn't have much information or solution on the Internet.
A problem occurred when attempting to deliver mail.
This exception was caused by:
com.sun.mail.smtp.SMTPSendFailedException: 550 Access denied - Invalid
HELO name (See RFC2821 4.1.1.1) ; nested exception is:
com.sun.mail.smtp.SMTPSenderFailedException: 550 Access denied -
Invalid HELO name (See RFC2821 4.1.1.1) .
Code that sends email via SMTP
<cfmail
from="no-reply#example.com"
server="mail.example.com"
to="example#gmail.com"
username="no-reply#example.com"
password="password"
port=587
subject="ColdFusion Email">ColdFusion</cfmail>
I use the same server, username and password on our PHP websites using PHPMailer everything works fine only on ColdFusion websites am getting this error.
Please advise

Relay access denied

I know that this question is not strictly related to coding, but I'm trusting the knowledge of this community to solve this and I thought it could still interest many people to know how to face this problem.
I am trying to send e-mails to people in a particular company, and keep getting the following error from the mail delivery system:
This is the mail delivery agent at messagelabs.com.
I was unable to deliver your message to the following addresses:
********#******.com
Reason: 554 5.7.1 <********#******.com>: Relay access denied
The message subject was: RE: ********
The message date was: **********
The message identifier was: **********
The message reference was: ************
Please do not reply to this email as it is sent from an unattended mailbox.
Please visit www.messagelabs.com/support for more details
about this error message and instructions to resolve this issue.
Last-Attempt-Date: ********
Remote-MTA: *********
Diagnostic-Code: smtp; 554 5.7.1 <********#******.com>: Relay access denied
Status: 5.7.1
Action: failed
Final-Recipient: ****; ********#******.com
Does anyone know what's going on here?
I am trying to send from a normal gmail account, straight from the web browser. It looks like I get this error only when I send e-mails to this specific domain, although we've been e-mailing in the past with no issues at all.
Thank you!

Unable to send email in Lemoon CMS?

The following error appears when trying to send email via LemoonCMS Test email page.
"Transaction failed. The server response was: 5.7.1 : Sender address rejected: Access denied"
The web.config settings is correct, as i uploaded a custom page using the same settings and its works fine.
The following error taken from the LOG:
2014-08-03 13:38:48.9950|INFO|Mindroute.Core.BootStrapper|Startup completed in 674ms
2014-08-03 13:38:49.2790|INFO|Mindroute.Core.Services.MailService|Sending mail 'Lemoon test message' to 'mfaris#kanzit.com'
2014-08-03 13:38:55.9600|INFO|Mindroute.Core.Services.MailService|Sending mail 'Lemoon test message' to 'mfaris#kanzit.com'
2014-08-03 13:39:09.1240|INFO|Mindroute.Core.BootStrapper|Shutting down. Reason: ConfigurationChange
2014-08-03 13:39:09.1290|INFO|Mindroute.Core.FullText.LuceneFullTextProvider|Disposing FullTextIndex
2014-08-03 13:39:09.1290|INFO|Mindroute.Core.BootStrapper|Shutdown completed in 6ms
Lemoon uses the settings from the MailDaemon when sending email. Have you checked that it is configured correctly? Otherwise it sounds from the error like the problem is with the mail server and not with Lemoon.

Send SMTP Email through Exchange Server Using Zend_Mail - How to Diagnose these Errors

I have the following code:
$config = array(
'auth' => 'login',
'username' => 'domain\user',
'password' => 'password',
'ssl' => 'tls',
'port' => 25,
);
$tr = new Zend_Mail_Transport_Smtp('192.168.101.11',$config);
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->setBodyText($text);
$mail->setFrom('noreply#domain.com');
$mail->addTo($user->getEmail());
$mail->setSubject('Email subject');
$mail->send();
When I try to connect using what should be the correct credentials I get the following error in the log:
2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - 5.7.1
2010-10-12T13:00:59-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp.php(261): Zend_Mail_Protocol_Abstract->_expect(250, 300)
#1 /usr/share/php/Zend/Mail/Transport/Smtp.php(207): Zend_Mail_Protocol_Smtp->mail('noreply#domain...')
#2 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#3 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
...
When I try to connect and send an email using a definitely bad password I get the following error:
2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - 5.7.3
2010-10-12T13:03:52-07:00 ERR (3): AdminController::emailPassword - #0 /usr/share/php/Zend/Mail/Protocol/Smtp/Auth/Login.php(95): Zend_Mail_Protocol_Abstract->_expect(235)
#1 /usr/share/php/Zend/Mail/Protocol/Smtp.php(217): Zend_Mail_Protocol_Smtp_Auth_Login->auth()
#2 /usr/share/php/Zend/Mail/Transport/Smtp.php(200): Zend_Mail_Protocol_Smtp->helo('localhost')
#3 /usr/share/php/Zend/Mail/Transport/Abstract.php(348): Zend_Mail_Transport_Smtp->_sendMail()
#4 /usr/share/php/Zend/Mail.php(1178): Zend_Mail_Transport_Abstract->send(Object(Zend_Mail))
#5 /var/www/mreserve/application/controllers/AdminController.php(458): Zend_Mail->send()
...
My problem, I don't really know how to diagnose these errors. Where do I look up what 5.7.1 and 5.7.3 error codes are described, etc? Google wasn't helping me too much. When I plug in the credentials for my personal GMail account I am able to send mail just fine, so I know that I can send emails when configured correctly.
A few other possibly helpful tidbits, I am trying to send from a company Exchange that has created an email account for this user, I am trying to send to an email outside of the domain, and I don't have a lot of access to the exchange server- other than a few screenshots on how they set up their email clients.
These are NDR (Non Delivery Report) codes for Exchange server.
Here is a (rather old) blog entry describing them, and another page listing the sames codes for exchange 2007.
5.7.1 Error code
"permission problem", which could point to a:
a SMTP relay problem. Your account is not authorized to send emails to another domain.
a sender/receiver problem. Your account is not authorized to send emails to a discussion list (because your account is not a member of it)
other specific restrictions on your account.
IMHO, only the SMTP logs can tell the exact cause.
5.7.3 Error code
"sender prohibited" or "Not Authorized, security problem", depending on the source; could be consistent with wrong password submission.
Hope this helps.