Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Postfix gmail relay problem

asteway
2012-10-12
2013-01-23
  • asteway
    asteway
    2012-10-12

    Dear all,

    I am a postfix newbie so my questions may sound trivial. But I searched everywhere and I couldn't find a clue. I wanted to set up a postfix relay to smtp.gmail.com.
    1) Do I need a domain name registration to do that? 
    2) Do I need to subscribe (relay subscription) to gmail?

    Please someone explain to me.

     
  • Simon Hobson
    Simon Hobson
    2012-10-12

    Firstly, this is not a general Postfix help forum, this is the forum for the Postfix Admin package which adds a web based front end for configuring virtual mailboxes with Postfix.

    Sorry, but I don't understand what you are asking for.

    Is it simply to send all your outbound mail via gmail ? If so then you should start by looking at the relayhost parameter http://www.postfix.org/postconf.5.html#relayhost in your main.cf. You will probably also need to configure SASL so that Postfix can authenticate with gmail before sending mail.

     
  • asteway
    asteway
    2012-10-12

    My apologies for parking without looking the signs. Thank you for replying though.

    Yes, what I want is exactly what you said. I configured main.cf and SASL. This is the output of the log /var/log/mail.log after issuing the command

    sendmail -bv myhomi@gmail.com
    

    .

    Oct 12 19:30:10 jhon postfix/pickup[4841]: 65DC04E0FCC: uid=0 from=<root>
    Oct 12 19:30:10 jhon postfix/cleanup[6014]: 65DC04E0FCC: message-id=<20121012163010.65DC04E0FCC@jhon.aait.edu.et>
    Oct 12 19:30:10 jhon postfix/qmgr[1253]: 65DC04E0FCC: from=<root@aait.edu>, size=275, nrcpt=1 (queue active)
    Oct 12 19:30:15 jhon postfix/smtp[6016]: 65DC04E0FCC: to=<myhomi@gmail.com>, relay=smtp.gmail.com[173.194.70.108]:587, delay=4.9, delays=0.07/0/4/0.77, dsn=2.1.5, status=deliverable (250 2.1.5 OK cl8sm3912903wib.10)
    Oct 12 19:30:15 jhon postfix/cleanup[6014]: F10574E0FD2: message-id=<20121012163015.F10574E0FD2@jhon.aait.edu.et>
    Oct 12 19:30:16 jhon postfix/qmgr[1253]: F10574E0FD2: from=<>, size=1830, nrcpt=1 (queue active)
    Oct 12 19:30:16 jhon postfix/bounce[6018]: 65DC04E0FCC: sender delivery status notification: F10574E0FD2
    Oct 12 19:30:16 jhon postfix/qmgr[1253]: 65DC04E0FCC: removed
    Oct 12 19:30:16 jhon postfix/local[6019]: F10574E0FD2: to=<root@aait.edu>, relay=local, delay=0.09, delays=0.05/0/0/0.04, dsn=2.0.0, status=sent (delivered to mailbox)
    Oct 12 19:30:16 jhon postfix/qmgr[1253]: F10574E0FD2: removed
    

    What I understand from the log output is that the message sent from root@aait.edu is deliverable and okay (please tell me if I'm not getting the log right). However, I don't find the email delivered when I log in to the gmail account I send to. So I am thinking is it because I don't have the domain name aait.edu registered with my ISP ? That is just my assumption. Like I said I am a postfix newbie:).

     
  • Simon Hobson
    Simon Hobson
    2012-10-12

    Ok, a few more questions, because I look at that and it doesn't look complete/normal.

    Firstly, what is in the bounce message ?

    Secondly, who is aait.edu ? The domain doesn't appear to be registered, so mail to it won't be deliverable.
    What domain are you using ?

     
  • asteway
    asteway
    2012-10-13

    1) The bounce message in /var/mail/root is

    tail /var/mail/root 
    Received: by jhon.aait.edu.et (Postfix, from userid 0)
        id C80D84E0FB5; Sat, 13 Oct 2012 14:20:38 +0300 (EAT)
    From: root@aait.edu
    Subject: probe
    To: myhomi@gmail.com
    Message-Id: <20121013112038.C80D84E0FB5@jhon.aait.edu.et>
    Date: Sat, 13 Oct 2012 14:20:38 +0300 (EAT)
    --C80D84E0FB5.1350127244/jhon.aait.edu.et--
    

    2)
    "The domain doesn't appear to be registered, so mail to it won't be deliverable"

    The domain aait.edu is not registered. So you mean both mail to it and from it wont be delivered if it is not registered? I assumed the relay should send mail via gmail.com and does not need a registered domain. Please correct me if I am wrong.
    3) Do I need any subscription/registration to gmail.com to use outbound relay through it?

    Please forgive my newbie-ness.

     
  • Simon Hobson
    Simon Hobson
    2012-10-13

    Basically, the domain does not exist. If a domain does not exist, then it's impossible to send mail to it. Nothing to do with whther you've registered the domain with your mail provider or anything like that.

    Now, I note that the bounce came back to aait.edu.et, so did you mean to be sending to that rather than aait.edu ?

    For a domain to exist, someone needs to have paid a registrar to register that domain for them. If no-one does that with a domain then it just "doesn't exist: as far as the internet is concerned - no DNS lookups against it will work, so it's impossible to deliver mail to anyone wanting to use it. So you can't just setup a server, configure it to be <some domain> and expect it to work - you need to "rent" that domain name after which it will exist and it's possible to setup DNS entries (such as MX records to say where to deliver mail).

    Lastly, you will normally need an account with a mail provider before you can send mail through them. Typically mail servers will only accept mail which is either a) for an account held on the server in which case anyone can send mail to it, or b) is 'from' a subscribed user of the service in which case their mail client may be required to authenticate* before it can send mail.
    * In the case of mail servers provided by an ISP, they may allow any user from their own IP address ranges to send mail without authenticating.

     
  • asteway
    asteway
    2012-10-14

    aait.edu.et is the domain name of my company and is already serving the SMTP of the company. The reason why you saw it in the bounce message is because that's what I configured as hostname.domainname while setting up my server. What I want is to send nagios notifications to users and not a full blown email server. Registering a domain just for that seemed like a waist.

    "as far as the internet is concerned - no DNS lookups against it will work"
    I think you have a point there. But the one question I have now is what is the use of the relay if I still have to rent a domain? The way I understood an outbound relay (as described here) is some mail provider with SMTP will do the email delivery on behalf of you while you forward your emails to it as an ordinary mail subscriber. If I still need an SMTP server with registered domain, I might as well do the entire email delivery on my own. 

     
  • Simon Hobson
    Simon Hobson
    2012-10-14

    But if the domain is not registered (ie does not exist) then there is nowhere for a mail server to send mail to.

    The point of the mail relay is to offload the task of delivering mail to a 3rd party. That will work fine if all you send it is mail that can be delivered.

    Why can't you send you mail to the users proper address ? Ie to aait.edu.et ?