Skip to content Skip to sidebar Skip to footer

Cannot Send Email Using Gmail Account From Android Using Javax

Error sending email: returns 451 4.5.0 SMTP protocol violation, see RFC 2821 g5sm13340466pfg.0 - gsmtp. After getting the oauth token, type and oauth expire from gmail. here th

Solution 1:

You're doing it the hard way. Let JavaMail do it for you.

Solution 2:

you have not mentioned the requirement of sending a mail if it is a form to be sent by mail then

Click here

or if you want to send directly using php then

<?php$to = $_POST['to'];
 $from = $_POST['from'];
 $subject = $_POST['subject'];
 $message = "From: ".$name."\r\n";\
 $headers = "From:" . $from;
 mail($to,$subject,$message,$headers);
 ?>

Solution 3:

Did you tried giving permission here:

https://www.google.com/settings/security/lesssecureapps

Some of the errors like that are because you don't have the complete properties, complements with this:

props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
props.put("mail.smtp.port", "587");

Post a Comment for "Cannot Send Email Using Gmail Account From Android Using Javax"