Problem at sending email with SwiftMailer library in Laravel 5.5.44 - php

I have this problem in Laravel 5.5.44 with Swift Mailer package trying to sending emails. This is the mail that the Swift Mailer package send to the server responsible for sending e-mails to the users:
This is the mail system at host user-ws.localdomain.
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
For further assistance, please send mail to postmaster.
If you do so, please include this problem report. You can
delete your own text from the attached returned message.
The mail system
<cxxx#gmail.com>: host gmail-smtp-in.l.google.com[74.125.71.26] said:
550-5.7.1 [41.X.X.X] The IP address sending this message does not have a
PTR 550-5.7.1 record setup. As a policy, Gmail does not accept messages
from IPs 550-5.7.1 with missing PTR records. Please visit 550-5.7.1
https://support.google.com/mail/answer/81126#authentication for more 550
5.7.1 information. p10-v6si4248809wrw.296 - gsmtp (in reply to end of DATA
command)
Can you guys help me?

Well, the error message that you received from googlemail is quite clear:
As a policy, Gmail does not accept messages from IPs 550-5.7.1 with
missing PTR records.
This means that the domain that you use in the FROM: header of your mail must have a DNS A-record pointed to the IP address of the host from which the email was sent.
To clarify:
your domain: example.com
your FROM adress: whitejson#example.com
your IP: 1.2.3.4
A-Record of domain example.com must map to IP 1.2.3.4 in your DNS server.
If the server is only in your local network it will be impossible to send a mail to googlemail that does not comply with this rule.
If you want to earn +2 reputation then mark this answer as accepted.

Related

PHP sendmail doesn`t send #RU domain Emails [duplicate]

This question already has answers here:
PHP mail function doesn't complete sending of e-mail
(31 answers)
Closed 3 years ago.
I'm using Laravel 5.8 for web development.
I made a short contact form , From where visitors are able to send me email with some data: name, their email, text ect...
I'm facing problem with #ru domain emails. They are not delivered into my inbox
Here is my .ENV
MAIL_DRIVER=sendmail
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=achelashvili22#gmail.com
MAIL_PASSWORD=myemailpassword
MAIL_ENCRYPTION=tls
My code in controller:
$from = 'test#testmail.com';
$to = "achelashvili22#gmail.com";
$subject = "Checking PHP mail";
$message = "PHP mail works just fine";
$headers = "From:" . $from;
mail($to,$subject,$message, $headers);
My form sends emails normally. Problem appears when I input #ru domain emails. when I change test#testmail.com with any Russian Domain email, for example avtandil1994#mail.ru
I'm getting mail Error in eebmail:
achelashvili22#gmail.com
host gmail-smtp-in.l.google.com [64.233.184.26]
SMTP error from remote mail server after end of data:
550-5.7.1 **Unauthenticated** email from mail.ru is not accepted due to domain's
550-5.7.1 **DMARC policy**. Please contact the administrator of mail.ru domain if
550-5.7.1 this was a legitimate mail. Please visit
550-5.7.1 https://support.google.com/mail/answer/2451690 to learn about the
550 5.7.1 DMARC initiative. x1si17683973wrm.306 - gsmtp
I have also done this for my email
Allow Access for Unreliable apps
and also using Mailable, but problem remains to be the same.
It's an issue behind the scenes. It is the kind, how your system delivers mail to the world.
If you have not setup a mail gateway, your system tries to send the mail directly to the mail gate of the receiver; it is identified by the MX record of DNS. And here nearly all mail servers have it own politics, which from and try mails are accepted.
The better way is to use a gateway to your provider and let it distribute the mails. The provider usually wants an authentication of the client. Therefore see the docu of your provider.

Failed Email Notifications

I am using phpmailer to send mail in Yii1. System which i have developed send thousand of emails daily. Normally it is working fine how ever sometime system fails to send email. After sometime that mail was delivered successfully (if system fails to send email first time then it will try again
). I am getting different types of email error some time. Not sure how to resolved those errors:
Mailer Error:
The following From address failed: test#test.com : MAIL not accepted
from server,x.x.x.x SMTP; Client was not authenticated to send
anonymous mail during MAIL FROM
[MWHPR11CA0017.namprd11.prod.outlook.com]SMTP server error: 5.7.57
SMTP; Client was not authenticated to send anonymous mail during MAIL
FROM [MWHPR11CA0017.namprd11.prod.outlook.com]
The following From address failed:
test#test.com : MAIL not accepted from server
SMTP Error:
Data not accepted.SMTP server error: 2.1.5 Recipient OK
The following From address failed:
test#test.com : MAIL not accepted from server,354,Start mail input;
end with < CRLF >.< CRLF >SMTP server error: Start mail input; end
with < CRLF >.< CRLF > SMTP server error: Start mail input; end with
< CRLF >.< CRLF >
SMTP Error:
The following recipients failed:xxx#xxx.com
So above is the different types of errors i have got sometimes. For #5 it seems that recipient was incorrect so that one is fine. But what about the others? How to solve them?
Depending on the MTA (mail transfer agent) installed on the server, ports used and SMPT settings, you may need to create the "from" user account on the server.
If you're using SSL/TLS, make sure the digital certificate(s) exist and has not expired. Also make sure your server's OS and MTA is up to date with the latest security standards -which if not compatible with latest industry standards may cause issues with the handshake/delivery mechanism.
you can always debug with command mail on your server. But as #argon already answered, the problem is probably with SMTP server.
I warmly suggest using external email marketing service if you are sending
thousand of emails daily.
Your server reputation will only get worse and will go straight to spam or rejected by SMTP (as in your case).

postfix mail not sent to gmail due to not authorized

I have setup a postfix mail server to my local ubuntu system. it sends mail properly but for gmail account it is not received from gmail account.
here is the output of maillog
Jun 15 14:29:33 aum30 postfix/smtp[29509]: D2E95360910: to=, relay=gmail-smtp-in.l.google.com[74.125.24.26]:25, delay=3, delays=0.09/0/2.3/0.69, dsn=5.7.1, status=bounced (host gmail-smtp-in.l.google.com[74.125.24.26] said: 550-5.7.1 [117.223.148.98] The IP you're using to send mail is not authorized to 550-5.7.1 send email directly to our servers. Please use the SMTP relay at your 550-5.7.1 service provider instead. Learn more at 550 5.7.1 https://support.google.com/mail/?p=NotAuthorizedError g2si1886184plk.487 - gsmtp (in reply to end of DATA command))
How can I solve this?
Your ISP may provide SMTP relays which will accept mail from your IP, and these servers should be authorized to send mail.
Your IP 117.223.148.98 is on the PBL: https://www.spamhaus.org/pbl/query/PBL1528741

PHP mail sender authentication warning

I am sending mail from my hosting server through this PHP code :
mail("myemail#gmail.com", "Subject: Verify Eg Net Solution ID", $randStr , "From: Egnetsolution#gmail.com" );
In myemail#gmail.com the email is send but there is a warning that is saying :
"This message may not have been sent by: Egnetsolution#gmail.com Learn more Report phishing"
What I have to do in my hosting domain server. I will really appreciate you if you can give me a solution.
Check this answer:
You can either set up google apps for your site and get a
Username#yourwebsite.com gmail account (more info here it's free), or
You will need to set up an e-mail address on your current server that
is Username#yourwebsite.com and use that as the $mail->from address.
Your E-Mail recipients are receiving the message because you are
telling google to send an e-mail from your server, and then you are
telling them that the mail is coming from gmail, which it isn't, it's
coming from your personal server. Since the from address and your
server address don't match, they flag it as spam. This is googles way
of preventing spam, to them it would be the same if you put
$mail->from(YOURMOM#LOL.com). The e-mail would still send, but your
domain name does not match the # address.

php mail function

I am using PHP to send an email with headers like this:
From: danny#mydomain.com
To: dannyfriend#gmail.com
When I check the headers in dannyfriend#gmail.com's (the recipient) email client, I see this header:
Received: from admin by gator1815.hostgator.com with local (Exim 4.69)
(envelope-from <danny#mydomain.com>)
But sometimes the mail goes to dannyfriend's spam folder, because the email is sent via hostgator.com not via mydomain.com as in the sender's email address.
What is really happening here? Why isn't it like this:
Received: from admin by somename.mydomain.com with local (Exim 4.69)
(envelope-from <danny#mydomain.com>)
I have seen an article describing this problem. Can somebody shine some light on what is happening with the SMTP server?
Summary:
Why is the SMTP server not using the message from FROM: header as the envelope-from?
You are actually using anonymous smtp relay. Your ISP provider probably the hostgator in that case is sending email on behalf of the email address that you are using. You may need to qualify your server to be a valid SMTP server that can receive and send emails. If the header does not match the actual from domain, the mail client or the receiving end suspects that it is coming from a fraudulent address and marks it as spam.

Categories