Want to receive bounce back emails on my gmail account - phpmailer

I am using phpmailer class to send email from my server. Below is my code, i am able to send email with this code to valid email address. I want to receive bounce back emails on my email address farazaleem#gmail.com but i am not receiving any email when i send email to invalid email account like dsfsdfdsfsfsfsfs#rtretreert.com
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPKeepAlive = true;
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 25;
$mail->Username = "xxxxxx#mydomain.com";
$mail->Password = "xxxxxxx";
$mail->SetFrom('farazaleem#gmail.com');
$mail->Subject = "Email body";
$mail->Sender = 'farazaleem#gmail.com';
$mail->MsgHTML($email_details);
$mail->AddAddress($entered_person_email, $full_name);
$mail->Send();

Related

Sending email via smtp only works if sender and recipient are the same v.v

import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
user = 'user#icloud.com'
password = 'apppassword'
host = 'smtp.mail.me.com'
text = 'E-Mail Body'
subject = 'This is a Subject'
to_emails = ['user2#icloud.com']
from_email = 'John Doe <user#icloud.com>'
msg = MIMEMultipart()
msg['From'] = from_email
msg['To'] = 'user2#icloud.com'
msg['Subject'] = subject
body = MIMEText(text, 'plain')
msg.attach(body)
msg_str = msg.as_string()
server = smtplib.SMTP(host, port=587)
server.starttls()
server.ehlo()
server.login(user, password)
server.sendmail(from_email, to_emails, msg_str)
server.quit()
I am trying to program an email client in python.
At the moment I fail to send via iCloud.
The email only arrives if I send the email to the iCloud mail that sends it. So to myself.
So you could say it's the loneliest email client in the world right now.
But all kidding aside, I don't get it. Is it me? Is it iCloud?

System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated in linux

Hi i want send a mail from my linux server my code block/project is working in my local(windows) but i get this error when i run my project in linux.
System.Net.Mail.SmtpException: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM
Here is my code block where is my problem? thanks.
string domain = "my.local";
string userName = "info";
string userPass = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes("AkXyz2*"));
string host = "mail.mymail.com.tr";
string fromMail = "mymail#mymail.com.tr";
System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
var smtp = new SmtpClient(host, 587);//port
smtp.EnableSsl = true;
System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(userName, userPass, domain);
smtp.Credentials = credentials;
smtp.ServicePoint.Expect100Continue = false;
ServicePointManager.ServerCertificateValidationCallback += (o, c, ch, er) => true;
...
...
smtp.Send(mail);

send the emails using my gmail account in python?

I m trying to send emails to my users through my Gmail account but it does not work although my Gmail login credentials are also correct but it gives an error
Here is the code for Email Sending!
if request.method == 'POST':
EmailAddress = request.form['Emails']
Subject = request.form['Subject']
Message = request.form['Message']
EmailList = EmailAddress.split(',')
Message = 'Subject: {}\n\n{}'.format(Subject, Message)
for EmailName in EmailList:
Server = smtplib.SMTP_SSL("smtp.gmail.com", 465)
Server.ehlo()
Server.login(UserEmail, UserPassword)
Server.sendmail(UserEmail, EmailName.strip(), Message)
response = "Success"
Server.quit()
Error:-(535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials t21sm2044741ejr.68 - gsmtp')

SMTP ERROR: Failed to connect to server: (0) & SMTP connect() failed. Mailer Error: SMTP connect() failed

I am trying to send a mail via phpMailer but I got below error
2019-03-28 10:54:00 SMTP ERROR: Failed to connect to server: (0)
2019-03-28 10:54:00 SMTP connect() failed. Mailer Error: SMTP
connect() failed.
I referred below links
https://stackoverflow.com/questions/43815571/mailer-error-smtp-connect-failed
https://stackoverflow.com/questions/21088062/phpmailer-smtp-connection-error
https://stackoverflow.com/questions/43999573/phpmailer-smtp-connect-error
https://stackoverflow.com/questions/36735979/mailer-error-smtp-connect-failed
https://stackoverflow.com/questions/30476024/smtp-connect-failed-phpmailer
but after implementing the solution as mention in the above links, getting the same error.
I tried with PHP mail() function for the same credential, it's working but I wanted to send a mail via SMTP.
here is my code
require('mail/class.phpmailer.php');
require('mail/PHPMailerAutoload.php');
$mail = new PHPMailer;
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Mailer = "smtp";
$mail->Host = 'mail.example.com';
$mail->SMTPAuth = true;
$mail->Username = 'From#example.com';
$mail->Password = 'password';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->setFrom('From#example.com', 'from');
$mail->addAddress('To#example.com', 'To');
$mail->isHTML(true);
$mail->Subject = 'subject';
$mail->Body = 'This is message';
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}

Mail rejected using phpmailer on GoDaddy.com host

Using this:
require("lib/class.phpmailer.php");
$mail = new PHPMailer();
$mail->Username = "XXX#validGoDaddyAccount.com";
$mail->Password = "xxx";
$mail->Subject = $subject;
$mail->Body= $message;
$mail->AddAddress($toAddr);
$mail->FromName = "XXXXXXXXXXXX";
$mail->IsSMTP();
$mail->SMTPDebug = 2;
$mail->Host = "smtpout.secureserver.net";
$mail->Port = 465;
$mail->SMTPSecure = "ssl";
$mail->SMTPAuth = true;
$mail->From = $mail->Username;
$mail->IsHTML(true);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
return true;
}
I get this response:
SMTP -> FROM SERVER:220 p3plsmtpa07-05.prod.phx3.secureserver.net ESMTP
SMTP -> FROM SERVER: 250-p3plsmtpa07-05.prod.phx3.secureserver.net hello [00.00.0.0], secureserver.net 250-HELP 250-AUTH LOGIN PLAIN 250-SIZE 31457280 250-PIPELINING 250-8BITMIME 250 OK
SMTP -> FROM SERVER:550 User XXX has exceeded their send quota
SMTP -> ERROR: MAIL not accepted from server: 550 User XXX has exceeded their send quota
The following From address failed: XXX : MAIL not accepted from server,550,User XXXm has exceeded their send quota
SMTP server error: User XXX has exceeded their send quota
Mailer Error: The following From address failed: XXX : MAIL not accepted from server,550,User XXX has exceeded their send quota
SMTP server error: User XXX has exceeded their send quota
I know about setting the SMTP Relays for GoDaddy accounts and they are set right. I can send email from this account all day long as long as I don't use PHPmailer.
see the following line
SMTP -> FROM SERVER:550 User XXX has exceeded their send quota
That's why it is rejecting.
The solution is that I needed to pre-authorize with POP prior to starting the SMTP operation:
require("lib/class.phpmailer.php");
require_once('lib/class.pop3.php');
$pop = new POP3();
$pop->Authorise('pop.server.net', 110, 30, 'username', 'password', 1);
$mail = new PHPMailer();
...

Resources