LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 06-06-2006, 10:43 AM   #1
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Rep: Reputation: 15
how to send emails through ISP's smtp server


Hi. I've an fc5 box at home. I'd like to be able to send emails to the internet (outside home network) with something simple like this

cat /etc/hosts | mail foo@bar.com

my ISP's smtp host requires authentication. Any idea how to get the fc5 machine to automatically send all emails to the ISP's smtp & authenticate in the process?

TIA!!!
 
Old 06-06-2006, 11:55 AM   #2
b0nd
Senior Member
 
Registered: Jan 2005
Distribution: Slackware, BackTrack, Windows XP
Posts: 1,020

Rep: Reputation: 45
Quote:
Originally Posted by coontie
Hi. I've an fc5 box at home. I'd like to be able to send emails to the internet (outside home network) with something simple like this

cat /etc/hosts | mail foo@bar.com

my ISP's smtp host requires authentication. Any idea how to get the fc5 machine to automatically send all emails to the ISP's smtp & authenticate in the process?

TIA!!!
tough job man.
now a days most of the admins don't allow mail relaying.
otherwise you could have easily "telnet" into the ISP port number 25 SMTP port and send mails from any fake id to any genuine mail id.
Some government servers still allow them . Search them on your own risk.

regards
 
Old 06-06-2006, 12:08 PM   #3
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
You want to configure your FC5 sendmail to send all mail to the ISP, which you can do in /etc/mail/sendmail.mc with (for example):

define(`SMART_HOST',`mail.optonline.net')dnl
MASQUERADE_AS(`optonline.net')dnl
FEATURE(masquerade_envelope)dnl

You need to have your sendmail authenticate, so also add:

FEATURE(`authinfo')dnl

In /etc/mail/authinfo:

Authinfo:mail.optonline.net "U:<username>" "I:<identity>" "P:<password>" "M:LOGIN PLAIN"

Rebuild the sendmail.cf:

make -C /etc/mail

Restart sendmail:

service sendmail restart

Last edited by macemoneta; 06-06-2006 at 12:10 PM.
 
Old 06-06-2006, 12:24 PM   #4
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
Thank you.

I followed your instructions (had to adjust hosts.allow also but nevermind that).

I see this in the maillog:

Quote:
Jun 6 13:21:03 fedora sendmail[5882]: k56HL368005882: from=root, size=217, class=0, nrcpts=1, msgid=<200606061721.k56HL368005882@localhost.localdomain>, relay=root@localhost
Jun 6 13:21:03 fedora sendmail[5883]: k56HL3T9005883: from=<root@localhost.localdomain>, size=516, class=0, nrcpts=1, msgid=<200606061721.k56HL368005882@localhost.localdomain>, proto=ESMTP, daemon=MTA, relay=fedora [127.0.0.1]
Jun 6 13:21:03 fedora sendmail[5882]: k56HL368005882: to=logastellus@yahoo.com, ctladdr=root (0/0), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30217, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (k56HL3T9005883 Message accepted for delivery)
But the email never arrives.

mailq shows an empty queue.
 
Old 06-06-2006, 12:30 PM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Never must be a relative term; I've seen emails take an hour to go between ISPs. If you receive a successful 'sent', then the mail was accepted by your ISP. That's all you can do with email. Delivery is now up to the intermediate systems.
 
Old 06-06-2006, 12:45 PM   #6
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by macemoneta
Never must be a relative term; I've seen emails take an hour to go between ISPs. If you receive a successful 'sent', then the mail was accepted by your ISP. That's all you can do with email. Delivery is now up to the intermediate systems.
You are right!

I just changed the msg from yahoo to gmail and it arrived fine!

Still waiting for hotmail & yahoo.. I can't believe they've such terrible mail servers.. Gmail rules!
 
Old 06-06-2006, 12:55 PM   #7
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
The only problem is that the emails arrive like this:

<root@localhost.localdomain>

I want them to look like they came from my official ISP email. I have this:

[root@fedora ~]# cat /etc/mail/userdb
root@fedora susanb@rr.com
[root@fedora ~]#

but that doesn't seem to be doing anything. What am I missing?
 
Old 06-06-2006, 03:24 PM   #8
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
In /etc/mail/sendmail.mc add:

MASQUERADE_DOMAIN(`rr.com')dnl
FEATURE(masquerade_entire_domain)dnl

Rerun the make and restart of sendmail.

Now all your emails look like they come from "user@rr.com".

If you are sending email as root, and want it to appear to come from another userid (for example, "susanb") with the mail command, you need to su to that user:

/bin/su - susanb -c "/bin/mail -s \"Some Subject\" destination-user@destination-domain.com" < somefile

Last edited by macemoneta; 06-06-2006 at 04:20 PM.
 
Old 06-06-2006, 04:07 PM   #9
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by macemoneta
In /etc/mail/sendmail.mc add:

MASQUERADE_DOMAIN(rr.com)dnl
FEATURE(masquerade_entire_domain)dnl

Rerun the make and restart of sendmail.

Now all your emails look like they come from "user@rr.com".

If you are sending email as root, and want it to appear to come from another userid (for example, "susanb") with the mail command, you need to su to that user:

/bin/su - susanb -c "/bin/mail -s \"Some Subject\" destination-user@destination-domain.com" < somefile
OK, I'll try this when I get home. BTW, do I still need to keep userdb file or no?

the amazing thing is that I was playing around with this and I rolled back all the changes I made, with authinfo & stuff, returning sendmail to its pristine state and guess what -- everything still worked! I was such an idiot, I didn't have to do anything. Apparently, FC5's sendmail just works right outta the box...
 
Old 06-06-2006, 04:14 PM   #10
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by macemoneta
In /etc/mail/sendmail.mc add:

MASQUERADE_DOMAIN(rr.com)dnl
FEATURE(masquerade_entire_domain)dnl

Rerun the make and restart of sendmail.

Now all your emails look like they come from "user@rr.com".

If you are sending email as root, and want it to appear to come from another userid (for example, "susanb") with the mail command, you need to su to that user:

/bin/su - susanb -c "/bin/mail -s \"Some Subject\" destination-user@destination-domain.com" < somefile
Just tried your suggestion, didn't do anything. Emails still arrive from localhost.localdomain

Jun 6 17:10:12 fedora sendmail[7533]: k56LABsg007531: to=<XXXXX@gmail.com>, ctladdr=<root@localhost.localdomain> (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120508, relay=gmail-smtp-in.l.google.com. [66.249.83.114], dsn=2.0.0, stat=Sent (OK 1149628305 i16si93078wxd)
[root@fedora ~]#

so... what can I do to troubleshoot this?

[root@fedora mail]# egrep "MASQ|domain" sendmail.mc
MASQUERADE_DOMAIN(rr.com)dnl
FEATURE(masquerade_entire_domain)dnl
FEATURE(always_add_domain)dnl
 
Old 06-06-2006, 04:19 PM   #11
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
I think that's my bad; forgot the quoting:

MASQUERADE_DOMAIN(`rr.com')dnl

You shouldn't need the userdb.
 
Old 06-06-2006, 07:04 PM   #12
coontie
Member
 
Registered: Jun 2003
Distribution: Fedora Core 5
Posts: 100

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by macemoneta
I think that's my bad; forgot the quoting:

MASQUERADE_DOMAIN(`rr.com')dnl

You shouldn't need the userdb.
no good. m4 the file, restart:

[root@fedora ~]# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
[root@fedora ~]# service sendmail restart
Shutting down sendmail: [ OK ]
Shutting down sm-client: [ OK ]
Starting sendmail: [ OK ]
Starting sm-client: [ OK ]
[root@fedora ~]# cat /etc/services | mail XXXXXX@gmail.com


in the file:

dnl define(`SMART_HOST',`smtp.your.provider')
MASQUERADE_DOMAIN(`rr.com')dnl
FEATURE(`masquerade_entire_domain')dnl
dnl #

i tried with & w/o quotes in the FEATURE section... still:



Date: Tue, 6 Jun 2006 19:59:13 -0400
From: root <root@localhost.localdomain>
Message-Id: <200606062359.k56NxDSR007811@localhost.localdomain>
To: XXXXXX@gmail.com

man.. I hate to keep bugging you but what do you think the problem is???
 
Old 06-06-2006, 08:22 PM   #13
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
Sorry, I'm at a loss. Can you check your sendmail.mc to make sure that all references to "localhost.localdomain" are commented out? Also, verify that your sendmail.cf has been properly created. You should see entries like:

DSmail.rr.com
DMrr.com

It might be necessary to set your machine's domain name to 'rr.com' (via system-config-network) - but I don't remember having to do that.

Perhaps someone else can chime in with a suggestion?
 
Old 06-06-2006, 08:25 PM   #14
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 326Reputation: 326Reputation: 326Reputation: 326
I just noticed - your smart host is commented out. Instead of:

dnl define(`SMART_HOST',`smtp.your.provider')

You should have:

define(`SMART_HOST',`mail.rr.com')dnl

Note: replace 'mail.rr.com' with the SMTP server for rr.com.
 
Old 06-07-2006, 02:20 PM   #15
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,088

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
WOW! This is all so complicated!

Use sendEmail. It works exactly as you want:

echo "text body" | sendEmail [options]

In the options you specify recipient, sender AND password authentication as required by your ISP.

Look for both sendEmail and sendemail package. I always forget whether there is a caps in the name or not.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Java - Send and Recieve emails From pop and smtp servers MRMadhav Programming 4 03-29-2006 01:57 PM
Need to set up personal SMTP server to send email Whiskers Linux - General 3 08-29-2004 02:33 PM
HELP?!?!?! I can't send mail through my ISP's server. Wolfy Red Hat 2 08-19-2004 06:26 PM
Using Postfix the send email via another smtp server - to anyone. scarstens Linux - Newbie 1 01-27-2004 03:31 PM
Postfix newbie - send to ISP SMTP server not working deanquanne Linux - Software 2 11-05-2003 01:22 PM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration