-1

On my Ubuntu server, I use Plesk to manage email accounts, among other things.

Emails to info@mydomain.com are automatically forwarded to myname@gmail.com. No problems so far.

But today I received an email in my Gmail inbox:

  • From: someone@otherwebsite.com via mydomain.com
  • To: info@mydomain.com

So my question is (regarding the via mydomain.com): Is someone sending me mails via my own server?

I've tried to check if there is a security problem. So I used Putty to connect from my computer at home to my webserver. I used telnet mydomain.com 25.

Then I entered mail from: info@mydomain.com and the response was 250 2.1.0 Ok.

Now when I send rcpt to: person@example.com, it fails with 554 5.7.1 <person@example.com>: Relay access denied. But when I type my own address again (rcpt to: info@mydomain.com), it seems to succeed: 250 2.1.5 Ok.

Does that mean anyone can send emails to me via my own server?

The whitelist in Plesk's mail settings has only two entries:

  • 127.0.0.0 / 8
  • ::1 / 128

Are they okay?

Now I've changed the setting "Relaying" from "Authorization required for SMTP" to "Closed". rcpt to: info@mydomain.com now results in 451 4.7.1 Service unavailable - try again later. Has this been the solution?

HopelessN00b
  • 53,795
  • 33
  • 135
  • 209
caw
  • 33
  • 1
  • 1
  • 8
  • 2
    Sending email to a recipient who's domain your email server is authoritative for is not relaying. That is how email works. The responses you got from both tests were correct. You need to set the setting back to "Authorization required for SMTP". – joeqwerty Dec 13 '13 at 17:33
  • But why is there an email in my Gmail inbox where Gmail says after the "via" that it has been sent from _my_ server? I have zero experience with server administration, but to me, this doesn't seem to be right. – caw Dec 13 '13 at 20:08
  • "But why is there an email in my Gmail inbox where Gmail says after the "via" that it has been sent from my server?" - Maybe because you're forwarding the email from your server to that Gmail address? That's what you've told us. – mfinni Dec 13 '13 at 20:43
  • [Administration panels are off topic](http://serverfault.com/help/on-topic). [Even the presence of an administration panel on a system,](http://meta.serverfault.com/q/6538/118258) because they [take over the systems in strange and non-standard ways, making it difficult or even impossible for actual system administrators to manage the servers normally](http://meta.serverfault.com/a/3924/118258), and tend to indicate low-quality questions from *users* with insufficient knowledge for this site. – HopelessN00b Feb 26 '15 at 07:51

2 Answers2

4

All mail to you has to come through your own server. That's why you have a server. This isn't relaying, it's called "how email works."

How else would you expect to be able to receive email from external senders, ever?

/edit

It was addressed to a recipient that your mail server is authoritative for. So of course your mailserver will accept it. Think of this logically - if I want to send you an email, I send the email to info@mydomain.com (your address). My mailserver looks up the MX record for mydomain.com. Behold, that's your server. My mailserver connects, via SMTP, to your server. It says

"HELO, I have MAIL FROM mfinni@example.com, RCPT TO info@mydomain.com"

Your mailserver knows that it's authoritative for mydomain.com - it will accept email, from anyone in the world (that isn't blocked) to recipients there. It doesn't give one crap who I am (in this scenario) - I could be myself, I could be your spouse, I could be someone from another country peddling questionable medical devices.

If my mailserver had said

"HELO, I have MAIL FROM mfinni@example.com, RCPT TO info@somewhere-else.com"

I would get the same thing you tested, Relay access denied.

Thus, you're not an open relay - yay! Gold star for being a good mail admin. Keep in mind, you generally always want your mailserver to receive mail for the domains it is authoritative for, because as I said, that's how email works.

/edit again

"But why is there an email in my Gmail inbox where Gmail says after the "via" that it has been sent from my server?

Probably because you're forwarding the email from your server to that Gmail address? That's what you've told us. So of course, it's sent from your server. That's how forwarding works. Your server received it (to a recipient that it is authoritative for, as discussed above) and then forwarded it to your gmail. So it shows as "via". It sounds like everything is working as you want it to.

mfinni
  • 36,144
  • 4
  • 53
  • 86
  • "All mail to you has to come through your own server". Yes, this is pretty obvious, but I just don't want my server to be an open mail relay. The Gmail thing (mail from stranger via my own server), is it just normal that this can happen? But if not, how could this have happened? Only if the sender knew my credentials? – caw Dec 13 '13 at 20:15
  • Edited my answer. Please go read a book on SMTP if you're going to be a mail admin. – mfinni Dec 13 '13 at 20:41
  • Good to have that clarified :) Thanks and sorry for the embarrassing question ;) And no, I'm not going to be a mail admin, fortunately. – caw Dec 13 '13 at 22:00
2
  1. Someone sends you an email.

  2. This email gets forwarded from your server to your Gmail email address.

  3. The email arrives in your Gmail mailbox as email from someone@somedomain.com via yourserver.com

  4. You can send an email via telnet from someone@somedomain.com to you@yourdomain.com because your server is authoritative for yourdomain.com and accepts email for recipients at yourdomain.com.

  5. You cannot send an email via telnet from someone@somedomain.com to someoneatsomeotherdomain.com because your server is not authoritative for and does not relay email for someotherdomain.com.

I don't see what the problem is. It sounds to me like everything is working exactly as it should.

joeqwerty
  • 109,901
  • 6
  • 81
  • 172