LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Configure SendMail to send mails to Googlemail? (https://www.linuxquestions.org/questions/linux-newbie-8/configure-sendmail-to-send-mails-to-googlemail-796451/)

arashi256 03-19-2010 05:15 AM

Configure SendMail to send mails to Googlemail?
 
I am on a residential ISP. My Linux server at home is on 24/7 and I use DynDNS to access it from anywhere. I have sendmail running and it sends various system alerts to my root mail which I pickup with "mail" when logged into the server via SSH. Is it possible to configure sendmail to send these mails to my GoogleMail account without the server being a "legitimate" e-mail server....so I don't have to mess with TX records or whatever they're called like you get with business-style Internet accounts? I know at work when we set up our own e-mail server, we had to update the TX record (whatever that is) so that mail from people outside the office would reach us.

Any resources or advice on how to do this would be great, assuming it's possible.

Erm - I've not explained that too well, but hopefully someone will know what I mean :D

bathory 03-19-2010 05:36 AM

Hi,

Have you ever tried to send an email from your server and see what happens? Maybe all you have to do is to define a smarthost for sendmail, if your ISP doesn't let you use your mailserver for outgoing mail.
You can test with:
Code:

mail -s "Test" yourname@gmail.com < /dev/null
Give it a shot and see how it goes.

Regards

arashi256 03-19-2010 05:44 AM

Good idea - but didn't work :) Got returned. Presumably at the very least I'd need to configure SendMail at the minimum to point to my ISP's smtp server?

bathory 03-19-2010 05:54 AM

You should have looked at the logs (/var/log/maillog usually) to help us identify the reason mail was returned.
Also posting distro, sendmail version etc could help

Regards

arashi256 03-19-2010 06:04 AM

Apologies - I'm using Fedora 12 and my version of sendmail is 8.14.3. My maillog looks like this: -

Code:

Mar 19 10:40:13 joshua11 sendmail[1784]: o2JAeCvj001784: from=<root@joshua11>, size=490, class=0, nrcpts=1, msgid=<201003191040.o2JAeBdC001783@joshua11>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Mar 19 10:40:13 joshua11 sendmail[1783]: o2JAeBdC001783: to=xxxxxx@googlemail.com, ctladdr=root (0/0), delay=00:00:02, xdelay=00:00:01, mailer=relay, pri=30226, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o2JAeCvj001784 Message accepted for delivery)
Mar 19 10:41:16 joshua11 sendmail[1799]: o2JAfFDZ001799: from=root, size=226, class=0, nrcpts=1, msgid=<201003191041.o2JAfFDZ001799@joshua11>, relay=root@localhost
Mar 19 10:41:16 joshua11 sendmail[1801]: o2JAfGg2001801: from=<root@joshua11>, size=490, class=0, nrcpts=1, msgid=<201003191041.o2JAfFDZ001799@joshua11>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Mar 19 10:49:37 joshua11 clamd[1587]: SelfCheck: Database status OK.
Mar 19 10:50:16 joshua11 sendmail[1786]: o2JAeCvj001784: to=<xxxxxx@googlemail.com>, ctladdr=<root@joshua11> (0/0), delay=00:10:03, xdelay=00:10:03, mailer=esmtp, pri=120490, relay=alt4.gmail-smtp-in.l.google.com. [209.85.221.94], dsn=4.0.0, stat=Deferred: Connection timed out with alt4.gmail-smtp-in.l.google.com.


bathory 03-19-2010 06:23 AM

It looks like you cannot reach gmail maybe because of your isp blocks your mail server..
To add your isp mail server as a smarthost, edit /etc/mail/sendmail.cf (maybe yours is in a different location), find the line hat starts with DS and change it, to:
Code:

DSmail.isp.com
Of course you need to use the real name of the isp mail server and make a backup of sendmail.cf before editing. After that restart sendemail service and test again.

arashi256 03-19-2010 06:32 AM

Thanks - I did that and tried again and got it returned again with a different error -

Code:

>    ----- The following addresses had permanent fatal errors -----
> <xxxxxx@googlemail.com>
>    (reason: 553 5.1.8 <root@localhost.localdomain>: Sender address rejected: Domain not found)
>
>    ----- Transcript of session follows -----
> ... while talking to smtp.orangehome.co.uk.:
> >>> MAIL From:<root@localhost.localdomain> SIZE=706
> <<< 553 5.1.8 <root@localhost.localdomain>: Sender address rejected: Domain not found
> 501 5.6.0 Data format error

Maillog looks like: -

Code:

Mar 19 11:24:40 joshua11 sendmail[2371]: o2JBObYj002371: to=<root@joshua11>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31730, dsn=2.0.0, stat=Sent
Mar 19 11:24:55 joshua11 sendmail[2383]: o2JBOtHA002383: from=root, size=226, class=0, nrcpts=1, msgid=<201003191124.o2JBOtHA002383@joshua11>, relay=root@localhost
Mar 19 11:24:56 joshua11 sendmail[2384]: o2JBOtjk002384: from=<root@joshua11>, size=490, class=0, nrcpts=1, msgid=<201003191124.o2JBOtHA002383@joshua11>, proto=ESMTP, daemon=MTA, relay=localhost [127.0.0.1]
Mar 19 11:24:56 joshua11 sendmail[2383]: o2JBOtHA002383: to=xxxxxx@googlemail.com, ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=relay, pri=30226, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (o2JBOtjk002384 Message accepted for delivery)
Mar 19 11:24:58 joshua11 sendmail[2386]: o2JBOtjk002384: to=<xxxxxx@googlemail.com>, ctladdr=<root@joshua11> (0/0), delay=00:00:02, xdelay=00:00:02, mailer=relay, pri=120490, relay=smtp.orangehome.co.uk. [193.252.22.140], dsn=5.6.0, stat=Data format error
Mar 19 11:24:58 joshua11 sendmail[2386]: o2JBOtjk002384: o2JBOwjk002386: DSN: Data format error
Mar 19 11:24:58 joshua11 sendmail[2386]: o2JBOwjk002386: to=<root@joshua11>, delay=00:00:00, xdelay=00:00:00, mailer=local, pri=31730, dsn=2.0.0, stat=Sent

Usually, when using, say, Outlook (urgh), I'd have to supply my ISP account username and password to send e-mails. Does this still apply if I'm simply using the smtp.orangehome.co.uk server as a relay?

bathory 03-19-2010 06:46 AM

gmail rejects your mail because it comes from an unqualified domain (localhost.localdomain)
You can try to edit /etc/hosts and add your domain in localhost address and see if it works
Code:

127.0.0.1 domain.com localhost.localdomain
x.x.x.x domain.com

(x.x.x.x being your ip address.
If it doesn't work, then you have to use masquerading

Do not forget to always make backups before editing files

Regards

arashi256 03-19-2010 07:00 AM

That didn't work...my /etc/hosts file entry looks like: -

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 joshua11.<dummydomain>.org

Dummydomain actualyl links to my DynDNS account hostname domain, but it's not "real" as such. Thank you anyway.

bathory 03-19-2010 08:19 AM

The domain must be existant in order to prevent spammers
Use your isp domain name and put it first in /etc/hosts.
Code:

127.0.0.1 isp-domain.com localhost localhost.localdomain

arashi256 06-11-2010 07:14 AM

Quote:

Originally Posted by bathory (Post 3904478)
The domain must be existant in order to prevent spammers
Use your isp domain name and put it first in /etc/hosts.
Code:

127.0.0.1 isp-domain.com localhost localhost.localdomain

Back to this - I have a domain with DynDNS, but my hostname is different on this box. Any more ideas? Still can't get mail sent from my server to my ISP and on to GoogleMail.

bathory 06-11-2010 07:48 AM

Reviewing the thread I saw that I've missed
Quote:

Usually, when using, say, Outlook (urgh), I'd have to supply my ISP account username and password to send e-mails. Does this still apply if I'm simply using the smtp.orangehome.co.uk server as a relay?
In this case you have to supply the same info to sendmail, so it can use the ISP mail server as a relay.
Since you're using fedora have a look at this post, to see what you need to do. Before anything else you should backup your current sendmail.mc and sendmail.cf

Regards

arashi256 06-11-2010 08:30 AM

I'm still getting an error...

Code:

Jun 11 14:16:53 joshua11 sendmail[13852]: o5BDGq0c013850: o5BDGr0c013852: DSN: Data format error
Jun 11 14:16:53 joshua11 sendmail[13852]: o5BDGr0c013852: to=xxxxxx@googlemail.com, delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31728, relay=smtp.orangehome.co.uk., dsn=2.0.0, stat=Sent (Ok: queued as 5280270008A8)

My /etc/mail/sendmail.mc with the relevant parts is: -

Code:

define(`SMART_HOST',`smtp.orangehome.co.uk')dnl
FEATURE(`authinfo',`hash /etc/mail/authinfo.db')dnl
dnl MASQUERADE_AS('joshua7.homelinux.org')dnl
MASQUERADE_AS(joshua7.homelinux.org)dnl
FEATURE(`masquerade_envelope')dnl
LOCAL_DOMAIN(`joshua7.homelinux.org')dnl

My /etc/mail/authunfo looks like: -

Code:

AuthInfo:smtp.orangehome.co.uk "U:root" "I:<SMTP SERVER USER HERE>" "P:<SMTP SERVER PASSWORD HERE>" "M:LOGIN PLAIN".
Any ideas?

bathory 06-11-2010 08:56 AM

What's in the mail sent back to you?

arashi256 06-11-2010 08:58 AM

That's just it, the mail never actually gets bounced back. It just kinda vanishes.


All times are GMT -5. The time now is 10:38 PM.