Gmail not delivering email even though giving 250 OK - email

I have configured my postfix and dovecot correctly, I can send and receive email on my server.
Here`s the snag - if I send email from Thunderbird via SMTP on my server, it gets delivered to gmail within seconds, I can see it in my inbox, no problem there (this gives me the notion, that SMTP itself is working just fine).
However if I try to send email from my web app (written in CakePHP3), the postfix shows response from gmail servers as 250 OK, I see timestamp, token, everything. However email never shows in my inbox when I log in to gmail.
Since email gets delivered from Thunderbird and not from app I guess there is something wrong with transporter in CakePHP, here`s the config:
'EmailTransport' => [
'default' => [
'className' => 'Smtp',
'host' => 'mydomain.com',
'port' => 587,
'timeout' => 30,
'username' => 'myuser',
'password' => 'mypassword',
'tls' => true,
]
]
However the app has no problem delivering email to my work email account. Also I tried sending email to my girlfriend's account (she doesn`t use gmail) and it is delivered as well. Both times correctly via TLS.
Any thoughts what does gmail want that Thunderbird has and the app might not be sending ? I used diff on email source sent from app and TB and could not see anything relevant.
Any thought would be greatly appreciated.

Related

550 Verification failed: No such user. Sending mail with Mailgun to CPanel email

I am creating a webservice with Mailgun to send out emails. It will BCC my own domain's email for every email sent out. Assuming my domain is "example.com". For every email sent out to a customer, say, customer1#gmail.com, I will BCC its content to sales#example.com.
Currently, the domain example.com and its email is hosted on a server with CPanel.
In Mailgun, I have added and verified the domain example.com. Using this domain, I've sent a mail to customer1#gmail.com and sales#example.com. The email is sent without issues to Gmail, however when sending to sales#example.com, I keep getting the error Server response: 550 550 Verification failed for <bounce+e0f051.e0179a-sales=example.com#example.com> No Such User Here.
What's baffling here is that if i send the email via Mailgun with another verified domain such as anotherexample.com, and then using this, I send my mail to sales#example.com. The email arrives perfectly fine without errors.
So far, the things I've tried:
Added Mailgun suggested SPF and DKIM
Modified SPF to include my CPanel server's IP (together with Mailgun SPF)
Deleted both the SPF and DKIM (one at a time and both at once)
Verified that the email sales#example.com exists. Using the CPanel webmail's interface, I can send and receive emails just fine.
Tried updating the CPanel MX entries Email routing from Local -> Automatic -> Remote. ("Local" works the best. If its set to "Remote", email sending and receiving doesnt work at all, even if mails are sent through Gmail/Hotmail).
My current MX settings are:
Priority 0: mail.example.com
My current Zone file records on CPanel:
example.com A <some ip>
mail.example.com A <same ip as above>
The code I am using to send mails via Mailgun (Ruby):
mg_client = Mailgun::Client.new 'xxxxxxxxxxx'
message_params = {:from => from_email,
:to => customer.email,
:bcc => bcc_email,
:subject => MessageTemplate.email_subject,
:text => message}
result = mg_client.send_message('example.com', message_params).to_h!
I currently do not have the SPF and DKIM records in the zone files. I've added and removed them and they had no effect on the error (still delivers fine to Gmail too).
I've spend the whole on this, scouring forums and whatnot but can't seem to find a solution.
If at all relevant, I have a 301 redirect of example.com to www.example.com(Which has a CNAME pointing to another server). But I've researched and found out that 301 redirect does not affect emails.
I don't think this is a send-side problem. You're sending to sales#example.com, but you're getting errors relating to bounce+e0f051.e0179a-sales=example.com#example.com, which is a typical VERP address. Now, VERP addresses are fine, so long as you're expecting them. Given that you are not apparently providing that explicit address to MailGun, I assume that they are generating that address automatically. I would check their documentation for how they generate return-path (envelope sender) addresses, and either override the sender address (with just sales#example.com), or configure handling of those VERP addresses on your own inbound mail server.
Here is a mailgun explanation
This error occurs due to what is termed Sender Address Verification (SAV). During SAV, an email server performs an MX lookup upon the domain (example.com) listed within the message envelope's Mail-From field. SAV typically rejects the message if,
the sender's (in this case, Mailgun's) MX records are not configured for that domain AND
the domain of the message envelope's Mail-From field does not match the domain of the message header's From field.
https://help.mailgun.com/hc/en-us/articles/360011804533-Sender-Verification-Error

sending mail through cakephp3 appends via cp-in-12.webhostbox.net

i am facing a problem when i send email using cakephp3 on my hosting. Emails are being sent but when i view the recieved email in browser i see this along with the email address from i'm sending the email
From: no-reply#mail.com via cp-in-12.webhostbox.net
However when i check mail in phone's gmail client 'via cp-in-12.webhostbox.net' does not shows up.
Here is my code
$email = new Email('default');
$email->from(['no-reply#mail.com' => 'no-reply#mail.com'])
->to('mymail#gmail.com')
->subject('Test Mail')
->send('Thank You! for purchase! its a test mail');
}
Please help.
Thank You
Google appends the "via mail.domain.com" when the sending domain does not have any sort of SPF records on it. It's to notify users that the email may not have originated from the "From" email address' domain, but since you don't have any restrictions (set by SPF), Google can't tell if you're a bad guy, or just haven't set up your records yet. You're going to want to either setup some SPF and DKIM records (check with your webhost on how to do that), and that should eliminate those messages. The reason it doesn't appear on iPhone is because that platform does not have that feature.

send email error : Error 550, User account support#mydomain.com has sent too many emails

I have a forum, base on PHP (for many years).
One user pointed out that in recent days, the email sending system does not work properly.
I went Cpanel (in host) and tried to send an email (with Squirrelmail or Roundcube).
but in Squirrelmail, When I send the email, see the following error :
((
Requested action not taken: mailbox unavailable
550 User account support#mydomain.com has sent too many emails
))
and in Roundcube :
((
SMTP Error (550): Failed to add recipient "example#yahoo.com" (User account support#mydomain.com has sent too many emails).
))
I've never sent spam e-mails and My website ip is not on the blacklist for emails.
I even created a new email accout (with no special restrictions), but it is also faced with the same error.
That means point blank that the host you are trying to send to, has blocked your server. This could be do to spam complaints or other abuse issues, or even because that server is misconfigured. You would need to contact the host in question to ask why they have decided to block your server. You should also check to see if your server has been blacklisted. A good site to use to check that is:
mxtoolbox.com
On message, some providers puts aditional information such "has sent too many emails" "Your iP it's blocked", ...

Does setting a 'Reply-To' header mean a reply won't be sent to the 'From' address?

I'm sending an email programmatically upon a user's request, and I set the 'Reply-To' header to be different than the 'From' address. Many times a reply to this email will be sent to the 'From' address. My research here, RFC 4021, only suggests that a reply is sent to the 'Reply-To' address. A mention here, RFC 822, doesn't seem to apply to me because I'm not automatically generating any lists for replies. My testing in gmail has only sent replies to the 'Reply-To' address.
I get the feeling this may be email client specific because it doesn't happen in my testing, but the product owner still gets email replies to the address used as the 'From' address.
Does anyone have any experience with experience with this?
Thanks.
P.S. - I'm using Django to send the emails which are plain text, no html.

php mail function & smtp approach not sending email from yahoo.com and some other domains

I am trying to send email from PHP using mail function to gmail ID, but email is not being delivered to the recipient if sender defined in header is yahoo ID, but if sender is hotmail then email comes fine. IF it goes sometime then it gets delivered at spam and the message on top of the message is 'This message may not have been sent by: xxx#xxx.com'
I have also tried phpmailer with smtp and ssl is also enabled on server, but no luck. Server is linux based hosted on godaddy
Thanks
This is because you can't send mail from a yahoo address unless you send it through a yahoo server - documented here. It will be bounced with a DMARC failure.