cant send mail to gmail accounts

Discussion in 'Installation/Configuration' started by zogthegreat, May 26, 2010.

  1. till

    till Super Moderator

    If you like to run a mailserver, then you better use a server or virtual server in a datacenter with fixed IP and dont run the server at home. Running a mailserver reliably on a dynamic IP is not possible.

    The only alternative that you may have is that you use the mailserver of your ISP as relay server.
     
  2. zogthegreat

    zogthegreat New Member

    Hi till,

    Just checked with My ISP. The out going mailserver for them is: smtphm.sympatico.ca or mailhost.sk.sympatico.ca, (depends on who you are talking to over there!).

    Can you point me to a how to for relaying through my ISP mailserver?

    Thanks

    zog
     
  3. till

    till Super Moderator

    In ISPConfig go to system > server config, then click on the server, go to the mail tab. Then enter the mailserver name of your isp in the relayhost field and the username and password for the realy server in the relay user and relay password field.
     
  4. zogthegreat

    zogthegreat New Member

    Hi till,

    Did as you suggested, this is what I got;

    tail -f /var/log/maillog
    May 28 15:32:12 server1 postfix/qmgr[20610]: AFC86803E6: from=<bill@XXX.com>, size=1620, nrcpt=1 (queue active)
    May 28 15:32:13 server1 postfix/smtp[20618]: AFC86803E6: to=<william.YYY@gmail.com>, relay=smtphm.sympatico.ca[65.55.172.251]:25, delay=15, delays=15/0.21/0.09/0.02, dsn=5.7.0, status=bounced (host smtphm.sympatico.ca[65.55.172.251] said: 530 5.7.0 Must issue a STARTTLS command first (in reply to MAIL FROM command))
    May 28 15:32:13 server1 postfix/cleanup[20620]: 13A3D803ED: message-id=<20100528193213.13A3D803ED@server1.example.com>
    May 28 15:32:13 server1 postfix/qmgr[20610]: 13A3D803ED: from=<>, size=3625, nrcpt=1 (queue active)
    May 28 15:32:13 server1 postfix/bounce[20619]: AFC86803E6: sender non-delivery notification: 13A3D803ED
    May 28 15:32:13 server1 postfix/qmgr[20610]: AFC86803E6: removed
    May 28 15:32:13 server1 postfix/pipe[20623]: 13A3D803ED: to=<bill@XXX.com>, relay=maildrop, delay=0.21, delays=0.05/0.04/0/0.12, dsn=2.0.0, status=sent (delivered via maildrop service)
    May 28 15:32:13 server1 postfix/qmgr[20610]: 13A3D803ED: removed

    Any suggestions?

    thanks

    zog
     
  5. zogthegreat

    zogthegreat New Member

    Found theis thread: http://www.howtoforge.com/postfix_relaying_through_another_mailserver. Just tried this:

    postconf -e 'relayhost = smtphm.sympatico.ca'
    postconf -e 'smtp_sasl_auth_enable = yes'
    postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
    postconf -e 'smtp_sasl_security_options ='

    echo "smtphm.sympatico.ca user:passwd" > /etc/postfix/sasl_passwd

    chown root:root /etc/postfix/sasl_passwd
    chmod 600 /etc/postfix/sasl_passwd

    postmap /etc/postfix/sasl_passwd

    /etc/init.d/postfix restart

    and got this output:

    May 28 16:26:39 server1 sendmail[23456]: STARTTLS=client, relay=[127.0.0.1], version=TLSv1/SSLv3, verify=FAIL, cipher=DHE-RSA-AES256-SHA, bits=256/256
    May 28 16:26:39 server1 postfix/smtpd[23457]: B3F0C803DB: client=localhost.localdomain[127.0.0.1]
    May 28 16:26:39 server1 postfix/cleanup[23468]: B3F0C803DB: message-id=<54218.192.168.0.1.1275078399.squirrel@XXX.com>
    May 28 16:26:39 server1 postfix/qmgr[23450]: B3F0C803DB: from=<bill@XXX.com>, size=1167, nrcpt=1 (queue active)
    May 28 16:26:39 server1 sendmail[23456]: o4SKQd01023456: to="William YYY" <william.YYY@gmail.com>, ctladdr=bill@XXX.com (48/48), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30711, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (Ok: queued as B3F0C803DB)
    May 28 16:26:39 server1 postfix/smtpd[23457]: disconnect from localhost.localdomain[127.0.0.1]
    May 28 16:26:39 server1 imapd: Connection, ip=[::ffff:127.0.0.1]
    May 28 16:26:39 server1 imapd: LOGIN, user=bill@XXX.com, ip=[::ffff:127.0.0.1], port=[41919], protocol=IMAP
    May 28 16:26:39 server1 postfix/smtp[23469]: B3F0C803DB: to=<william.YYY@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.16, delays=0.09/0.06/0.01/0, dsn=4.7.4, status=deferred (TLS is required, but was not offered by host 127.0.0.1[127.0.0.1])
    May 28 16:26:39 server1 imapd: LOGOUT, user=bill@XXX.com, ip=[::ffff:127.0.0.1], headers=0, body=0, rcvd=890, sent=555, time=0
    May 28 16:26:40 server1 imapd: Connection, ip=[::ffff:127.0.0.1]
    May 28 16:26:40 server1 imapd: LOGIN, user=bill@XXX.com, ip=[::ffff:127.0.0.1], port=[41922], protocol=IMAP
    May 28 16:26:40 server1 imapd: LOGOUT, user=bill@XXX.com, ip=[::ffff:127.0.0.1], headers=3672, body=0, rcvd=322, sent=8035, time=0
    May 28 16:26:41 server1 imapd: Connection, ip=[::ffff:127.0.0.1]
    M
     
  6. zogthegreat

    zogthegreat New Member

    Just notice that there is a problem with my telnet output:

    [root@server1]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 server1.example.com ESMTP Postfix
    421 4.4.2 server1.example.com Error: timeout exceeded
    Connection closed by foreign host.

    When I go over to another machine and do:

    [bill@phoenix]# telnet XXX.com 25
    Trying 70.53.152.148...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 server1.example.com ESMTP Postfix
    421 4.4.2 server1.example.com Error: timeout exceeded
    Connection closed by foreign host.

    Any suggestions?

    thanks

    zog
     
  7. zogthegreat

    zogthegreat New Member

    I just downloaded and tried The Perfect Server - CentOS 5.5 x86_64 [ISPConfig 3] vmware image for here: http://www.howtoforge.com/download.php?id=5374_0 .

    When I try to: telnet localhost 25, I get this;

    root@192.168.0.100's password:
    Last login: Sat May 29 20:09:10 2010
    [root@server1 ~]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 server1.example.com ESMTP Postfix
    421 4.4.2 server1.example.com Error: timeout exceeded
    Connection closed by foreign host.


    I have no clue what I am doing wrong here, any suggestions?

    Thanks

    zog
     
  8. till

    till Super Moderator

    Which message gets logged in the maillog?
     
  9. zogthegreat

    zogthegreat New Member

    Hi till,

    [root@server1 ~]# telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.localdomain (127.0.0.1).
    Escape character is '^]'.
    220 server1.example.com ESMTP Postfix
    421 4.4.2 server1.example.com Error: timeout exceeded
    Connection closed by foreign host.

    [root@server1 ~]# tail -f /var/log/maillog (started before telnet)
    May 29 20:19:55 server1 amavis[2248]: Internal decoder for .tnef
    May 29 20:19:55 server1 amavis[2248]: Found decoder for .exe at /usr/bin/unrar; /usr/bin/lha; /usr/bin/arj
    May 29 20:19:55 server1 amavis[2248]: Using primary internal av scanner code for ClamAV-clamd
    May 29 20:19:55 server1 sendmail[2259]: alias database /etc/aliases rebuilt by root
    May 29 20:19:55 server1 sendmail[2259]: /etc/aliases: 77 aliases, longest 10 bytes, 779 bytes total
    May 29 20:19:55 server1 amavis[2248]: Found secondary av scanner ClamAV-clamscan at /usr/bin/clamscan
    May 29 20:19:55 server1 amavis[2248]: Creating db in /var/spool/amavisd/db/; BerkeleyDB 0.41, libdb 4.3
    May 29 20:19:57 server1 postfix/postfix-script: starting the Postfix mail system
    May 29 20:19:58 server1 postfix/master[2305]: daemon started -- version 2.3.3, configuration /etc/postfix
    May 29 20:19:58 server1 amavis[2248]: DKIM signature verification disabled, corresponding features not available. If not intentional, consider enabling it by setting: $enable_dkim_verification to 1, or explicitly disable it by setting it to 0 to quench down this warning.
    May 29 20:21:12 server1 postfix/smtpd[2655]: connect from localhost.localdomain[127.0.0.1]
    May 29 20:25:02 server1 postfix/smtpd[2805]: connect from localhost.localdomain[127.0.0.1]
    May 29 20:25:02 server1 postfix/smtpd[2805]: lost connection after CONNECT from localhost.localdomain[127.0.0.1]
    May 29 20:25:02 server1 postfix/smtpd[2805]: disconnect from localhost.localdomain[127.0.0.1]
    May 29 20:25:02 server1 dovecot: pop3-login: Disconnected (no auth attempts): rip=127.0.0.1, lip=127.0.0.1, secured
    May 29 20:25:02 server1 dovecot: imap-login: Disconnected (no auth attempts): rip=127.0.0.1, lip=127.0.0.1, secured
    May 29 20:26:12 server1 postfix/smtpd[2655]: timeout after CONNECT from localhost.localdomain[127.0.0.1]
    May 29 20:26:12 server1 postfix/smtpd[2655]: disconnect from localhost.localdomain[127.0.0.1]

    zog
     
  10. falko

    falko Super Moderator

    What's the output of
    Code:
    netstat -tap
    ? What's in /etc/hosts?
     
  11. zogthegreat

    zogthegreat New Member

    Hi falco,

    The output of netstat -tap is:

    [root@server1 ~]# netstat -tap
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    tcp 0 0 *:imaps *:* LISTEN 3636/dovecot
    tcp 0 0 *:pop3s *:* LISTEN 3636/dovecot
    tcp 0 0 localhost.localdomain:10024 *:* LISTEN 3683/amavisd (maste
    tcp 0 0 localhost.localdomain:10025 *:* LISTEN 7945/master
    tcp 0 0 *:mysql *:* LISTEN 3591/mysqld
    tcp 0 0 *:pop3 *:* LISTEN 3636/dovecot
    tcp 0 0 localhost.local:dyna-access *:* LISTEN 3506/clamd
    tcp 0 0 *:imap *:* LISTEN 3636/dovecot
    tcp 0 0 *:ftp *:* LISTEN 3812/pure-ftpd (SER
    tcp 0 0 localhost.localdomai:domain *:* LISTEN 3354/named
    tcp 0 0 localhost.localdomain:ipp *:* LISTEN 2867/cupsd
    tcp 0 0 *:smtp *:* LISTEN 7945/master
    tcp 0 0 localhost.localdomain:rndc *:* LISTEN 3354/named
    tcp 0 0 localhost.localdomain:58229 localhost.localdomain:mysql ESTABLISHED 3716/amavisd (ch2-a
    tcp 0 0 localhost.localdomain:55753 localhost.localdomain:mysql ESTABLISHED 3717/amavisd (ch1-a
    tcp 0 0 localhost.localdomain:mysql localhost.localdomain:58229 ESTABLISHED 3591/mysqld
    tcp 1 0 localhost.localdomain:41568 localhost.localdomain:10025 CLOSE_WAIT 3717/amavisd (ch1-a
    tcp 0 0 localhost.localdomain:mysql localhost.localdomain:55753 ESTABLISHED 3591/mysqld
    tcp 0 0 *:imaps *:* LISTEN 3636/dovecot
    tcp 0 0 *:pop3s *:* LISTEN 3636/dovecot
    tcp 0 0 *:pop3 *:* LISTEN 3636/dovecot
    tcp 0 0 *:imap *:* LISTEN 3636/dovecot
    tcp 0 0 *:webcache *:* LISTEN 5298/httpd
    tcp 0 0 *:http *:* LISTEN 5298/httpd
    tcp 0 0 *:tproxy *:* LISTEN 5298/httpd
    tcp 0 0 *:ftp *:* LISTEN 3812/pure-ftpd (SER
    tcp 0 0 localhost6.localdoma:domain *:* LISTEN 3354/named
    tcp 0 0 *:ssh *:* LISTEN 3478/sshd
    tcp 0 0 localhost6.localdomain:rndc *:* LISTEN 3354/named
    tcp 0 0 *:https *:* LISTEN 5298/httpd
    tcp 0 148 server1.example.com:ssh ::ffff:192.168.0.200:49658 ESTABLISHED 4806/0

    [root@server1 ~]# cat /etc/hosts
    # Do not remove the following line, or various programs
    # that require network functionality will fail.
    127.0.0.1 localhost.localdomain localhost
    192.168.0.100 server1.example.com server1
    ::1 localhost6.localdomain6 localhost6

    (The local IP is correct)

    thanks

    zog
     
  12. Torch_za

    Torch_za New Member

    gmail ....

    I'm pretty sure gmail is rejecting because of the dynamic dns and reverse lookup. on http://mxtoolbox.com what does the smtp check produce?

    Also what does the reverse dns lookup produce? It's a quick and nasty hack (aren't they all) but if you copy that string into /etc/postfix/main.cf such that

    smtpd_banner = REVERSE_LOOKUP_STRING ESTMP $mail_name (Debian/GNU)

    (it's right neart the top ... )

    see it that bites...
     
    Last edited: May 31, 2010
  13. zogthegreat

    zogthegreat New Member

    Hi Torch_za,

    OK, here's what I got:

    mx:XXX.net

    Not an open relay.
    0 seconds - Good on Connection time
    0.484 seconds - Good on Transaction time
    OK - 70.53.152.148 resolves to
    Warning - Reverse DNS does not match SMTP Banner

    Session Transcript:
    HELO please-read-policy.mxtoolbox.com
    250 server1.example.com [109 ms]
    MAIL FROM: <supertool@mxtoolbox.com>
    250 2.1.0 Ok [125 ms]
    RCPT TO: <test@example.com>
    554 5.7.1 <test@example.com>: Relay access denied [125 ms]
    QUIT
    221 2.0.0 Bye [125 ms]

    reverse lookup:

    PTR 70.XX.XXX.148 bas4-montreal28-1177917588.dsl.bell.ca 24 hrs

    From what I understand, I should do this:

    smtpd_banner = bas4-montreal28-1177917588.dsl.bell.ca $mail_name Debian/GNU)

    Is this what you meant? (googling right now!!!)

    Thanks

    zog
     
  14. Torch_za

    Torch_za New Member

    Code:
    smtpd_banner = bas4-montreal28-1177917588.dsl.bell.ca ESTMP $mail_name Debian/GNU)
    remember though this changes every time your ip resets.. a pain in the butt - if it works then you have your answer.:)
     
  15. zogthegreat

    zogthegreat New Member

    SOLVED!! (sort of!)

    Hi everyone,

    Well, finally success. I did the following:

    I created an account at http://www.dyndns.com/services/mailhop/outbound.html. It is $20.00 USD a year, but after messing with this for the last two months, IMO, well worth it!

    I longed into my ISPConfig interface and went to "System", then "Server Config", and then clicked on "server1.example.com".

    After, I clicked on the "Mail" tab, (not the upper "Email" tab).

    Under "relayhost" field, I entered:

    outbound.mailhop.org:2525

    Under Relayhost User" I entered the username given to me by dyndns.com.
    Under Relayhost Password, I entered the password given to me by dyndns.com.

    (NOTE: Not to sound silly, but use the info given to you by dyndns.com, not the example info I have listed!)

    I then restarted postfix and everything now works like a charm!!


    Many thanks to everyone how has tried to help me with this problem.

    I am still would like to figure out how to do SMTP with dynamic IP's, but for now I am happy!

    Thanks
    to all

    zog
     

    Attached Files:

    Last edited: Jun 4, 2010

Share This Page