Monday, December 29, 2014

sendmail - Email forwarding from my domain to gmail - FAIL




[There are numerous similar questions on ServerFault but I couldn't find one that was exactly on point]



Background: I use Gmail for my email client. My email is example@gmail.com. However the email that people communicate to me with is me@example.com. I run the server that hosts www.example.com and other domains, at ServerBeach.



Up to yesterday, I had SENDMAIL painlessly just forward emails to me@example.com to example@gmail.com and everything was fine, for several years in fact.



Suddenly my email stopped working - that is, my gmail account stopped receiving emails via the forward from my server.



Looking into it I found a bunch of emails sitting on my server with content like this:




... while talking to gmail-smtp-in.l.google.com.:
>>> RCPT To:
<<< 450-4.2.1 The user you are trying to contact is receiving mail at a rate that
<<< 450-4.2.1 prevents additional messages from being delivered. Please resend your
<<< 450-4.2.1 message at a later time. If the user is able to receive mail at that
<<< 450-4.2.1 time, your message will be delivered. For more information, please
<<< 450 4.2.1 visit xxxxxx://mail.google.com/support/bin/answer.py?answer=6592 u15si37138086qco.76
pitosalas@gmail.com... Deferred: 450-4.2.1 The user you are trying to contact is
receiving mail at a rate that
>>> DATA

<<< 550-5.7.1 [64.34.168.137 1] Our system has detected an unusual rate of
<<< 550-5.7.1 unsolicited mail originating from your IP address. To protect our
<<< 550-5.7.1 users from spam, mail sent from your IP address has been blocked.
<<< 550-5.7.1 Please visit xxxxx://www.google.com/mail/help/bulk_mail.html to review
<<< 550 5.7.1 our Bulk Email Senders Guidelines. u15si37138086qco.76
554 5.0.0 Service unavailable
... while talking to alt1.gmail-smtp-in.l.google.com.:


From what I've been researching, I think somehow someone has/is hijacking my domain name or something and this somehow has caused gmail's servers to notice and cut me off. But I don't know really what's going on nor do I see whatever emails might be involved.




I've read stuff on zoneedit.com that sounds like they might have a solution in their service for what I am trying to do. I also read a lot about admining DNS and SENDMAIL and tried various things, but nothing works.




  1. Can you tell from my description what is going on that caused GMail's server to stop accepting email from my server and is there a way to stop it?

  2. What is the 'correct' way to configure things so that emails to me@example.com behave as if they were sent to example@gmail.com?


Answer



On average, how many emails would you say are forwarded from your ServerBeach server to Google?




Do you have reverse DNS set up correctly with a matching "A" record for your ServerBeach Server? You can test that by doing an nslookup, but using your server's IP address for the query. I'm not sure how much you know about DNS so let me give you a brief overview:




  • An A record associates a domain name to an IP (so google.com's A record would be 1.2.3.4, for example.)

  • A Reverse DNS record does the opposite - so a query for 1.2.3.4 would return "google.com" to continue the previous example.

  • Most of the time, rDNS is irrelevant. However, some mail servers (google for example) like to see a matching rDNS record as an indication that you're not a spammer. Having an incorrect or mismatching rDNS record could cause your mail to bounce.



Sending too many messages or misconfigured DNS could cause you to be tagged as a spammer.




Also, head over to CheckOR.com and test to see if your mail server is an "Open Relay," meaning that anyone can use your server to send email to whoever they want (That's bad - and spammers have tools to scan for open relays to use them to send their spam.)


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...