LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-19-2010, 05:15 AM   #1
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Rep: Reputation: 62
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
 
Old 03-19-2010, 05:36 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 03-19-2010, 05:44 AM   #3
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
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?
 
Old 03-19-2010, 05:54 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 03-19-2010, 06:04 AM   #5
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
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.
 
Old 03-19-2010, 06:23 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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.
 
Old 03-19-2010, 06:32 AM   #7
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
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?
 
Old 03-19-2010, 06:46 AM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 03-19-2010, 07:00 AM   #9
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
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.
 
Old 03-19-2010, 08:19 AM   #10
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 06-11-2010, 07:14 AM   #11
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
Quote:
Originally Posted by bathory View Post
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.
 
Old 06-11-2010, 07:48 AM   #12
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
1 members found this post helpful.
Old 06-11-2010, 08:30 AM   #13
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
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?
 
Old 06-11-2010, 08:56 AM   #14
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
What's in the mail sent back to you?
 
Old 06-11-2010, 08:58 AM   #15
arashi256
Member
 
Registered: Jan 2008
Location: Brighton, UK
Distribution: Ubuntu 18.04 / CentOS 7.6
Posts: 397

Original Poster
Rep: Reputation: 62
That's just it, the mail never actually gets bounced back. It just kinda vanishes.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
prevent to send mails to public domains in sendmail mail2mphani Linux - Security 1 03-11-2009 12:37 PM
how to configure postfix (FD5) to send mails to gmail or any different domains subramanyabs1984 Linux - Server 3 02-26-2009 01:27 AM
2 sendmail servers cannot send/receive mails to each other kool_kid Linux - Server 2 02-20-2008 07:15 AM
using cron to send mails without using the sendmail parichay Linux - Enterprise 2 10-13-2006 09:39 AM
sendmail doesnt send mails spank Linux - Newbie 12 01-07-2004 02:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration