-   Linux - Newbie (
-   -   Mail server, can send out, but cant receive (

christopher_c 10-03-2007 01:26 PM

Mail server, can send out, but cant receive
Hi guys/girls,

Been trying to config my squirrelmail and mail server for about a week now and just seem to have run into 1 last problem.

Im able to send out emails from my squirrelmail account but I am unable to receive from outside sources(gmail)... Although I CAN receive email if i send mail internally.

This is the Delivery Status Notification I get back when I try to send to the email :

Technical details of permanent failure:
PERM_FAILURE: SMTP Error (state 13): 554 <>: Relay access denied

Any thoughts?

Oh yeah, some settings:

for sending messages im using 'Sendmail'

Su-Shee 10-03-2007 02:09 PM

Well, this errors message says: you're not allowed to use this mailserver as a relay.

Usally, this happens if you're (like me) a joe/jane average dyn ip internet user and you try to send outgoing mail over, but just sees "Oh, someone from some dyn ip ISP, DO I KNOW YOU?!".

Which is absolutely how it's supposed to be.

You have to use a relay you're allowed to use and usally have to authenticate yourself with a specific method (certificate, smtp auth...).

Some ISPs allow you automatically relaying in the moment you're a registered user to poll mail via IMAP or POP. (Gmail for example.)

Locally it's a totally different thing, there're just local applications involved and no ISP.

And what do you mean "unable to receive mail from outside sources like gmail"?! Mail sent to your gmail adress won't be devlivered to your host, it's delivered to gmail where you fetch it via POP3 and that's it. (Or click the web interface..)

I've got the following setup:

I receive mail to at least 5 accounts - gmail for example. ALL of those mails I fetch via POP3 or IMAP.

I send mail with msmtp (kind of a micro-mini-nano sendmail..) over a relay. This relay requires a certain authentication on my side, because I'm a mobile moving around notebook user and can't be identified via my IP adress. My mail client (mutt) hands over the mail to msmtp which hands over the mail to my relay after correctly being authenticated.

Where to get a relay?

* ask a friend

* check your ISP - usally relaying is included if you've got more than just "connectivity" and if you already got an inbox for mail

* gmail can only be used if your from-header indicate that you're actually mailing with your gmail identity.

(Sorry for the over simplification, but explaining smtp I think is not the easiest thing..)

christopher_c 10-03-2007 02:32 PM

Hi Su-Shee,

Thanks for the response.

Im not sure if I made myself clear about what the problem is, let me try again :)

Right now I am using SquirrelMail as my client to receive emails from my server. I ran the following command to see if I was able to send/receive from my terminal

"echo "hello" | mail admin"

I went to SM, logged in and saw the email "hello". This is what I meant by internally. I then went to Compose and sent an email to my GMAIL account to see if was able to send out externally and it worked.

Now, with the mail message in my gmail account, I wanted to see if was able to send back to the email to the same email address. Thats when i got the relay error and was not able to send to my squirrelmail email account.

Hope this makes more sense :)

Su-Shee 10-03-2007 03:14 PM

Is squirrelmail some kind of webmail thing?

Ah, yes it is. Where's it running exactly?

What is "your server"?

The applications and programs don't matter, it's the hosts where you come from and where you want to relay over.

Yes, you tested mail locally. No external server involved. Works.

*reread* *reread*

Aaah.. you ARE on you mailserver and there's a SM running and AFTER you sent a mail from your own server to your gmail and from there you can't reply to yourself?

Check the header of your mail at gmail and compare that to your mail setup - there's something fishy somewhere.

And do you really want to stick with sendmail and not just use anything a little bit more simple than that? (exim, qmail, postfix..)

christopher_c 10-03-2007 03:44 PM

Yup you got it.

Mail works locally, and i can send out to any type of hotmail/gmail/whatever email address, but just not reply back from an email i sent out.

I was looking into it more and am not sure if it has to do with some sort of authentication like you had mentioned earlier.Maybe something to do with MX record?(not familiar with it tho)


And do you really want to stick with sendmail and not just use anything a little bit more simple than that? (exim, qmail, postfix..)
Ive read that alot of people are using Postfix and not sendmail as the config for sendmail can be extremely daunting, but I am not sure yet if the problem lies with Sendmail or not.

Let me know if im wrong, but is it the IMAP server that has to do with receiving the email? If so, the problem would like there, no?

edit: My server is my virtual host which I use SSH Shell Client to get into.

Su-Shee 10-03-2007 04:10 PM

Ok, your own server tells you that you are not allowed to relay.

That means: If you reply on Gmail to your own adress, something sent in that mail header is wrong.

(Or the error message veils something else.)

And yes, for a mail server you need an MX record, this is a name server entry that this host does actually act as mailserver. But the mail wouldn't even be rejected in the first place if there wasn't some entry somewhere, because the host wouldn't be found at all.

I'll try to explain what you actually need:

The mailserver has to have an MX record. The domain must also exist. Usally, you should get both from your ISP where the server is located.

Second, the mailserver has to listen to the mail port. Receiving mail and sending mail are two different things. Obviously, something does listen. ;)

Third, when _sending_ outgoing mail, you'll have to set correct mail headers. With an easy setup, several smtp servers recognize the host and just add all necessary information by themselves. And I think here is you problem. Check the mail header of your own mail lying at Gmail's.

Right now, your server receives mail but seems to reject it.

What I would do: Log me in onto the server and make a telnet localhost 25 and construct a correct mail by hand and sent it to Gmail and reply to that. (If there isn't any obvious mistake in the mail header you've already got)

But I don't even touch sendmail, because I'm a total smtp idiot.

And imap has in a sense something to do with receiving mail, but usally your incoming mail would be took by your smtpd and transferred internally to your IMAP server where you can fetch it from anywhere else.

And it's totally possible that I'm talking utter nonsense because I'm not sure how your setup exactly look like.

christopher_c 10-03-2007 11:10 PM

thanks Su-Shee, I will be looking at it tomorrow morning.
Will follow up!

christopher_c 10-04-2007 05:09 PM

And so i finally figured out !!

I went and checked the headers of my email and realized it was saying the return address of localhost.localdomain.

I googled it and found this :

worked perfectely.

Thanks for your help Su-Shee!

All times are GMT -5. The time now is 07:42 AM.