LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-28-2009, 03:43 PM   #1
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Rep: Reputation: 0
Question How much should I know to send simple email


I am using CentOS 5.3 to learn linux.

Objective: I am writing a script that when my IP is changed, an email will be sent to inform me the new IP.
So, sending a short text thru internet by a command line is all I need.

I have do some reading that cover MUA MTA MDA, warnings about open relay, using of m4 and makemap, ... and I still have no idea where to find the answer I need, not even close.
I'm not setting mail server, and I intend not receiving email.

Please suggest me some areas/keywords to focus. Many thanks for your help.

Last edited by iwonder; 07-29-2009 at 03:26 AM.
 
Old 07-28-2009, 03:53 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
you don't need to know anything about mail really. just run "echo this is a message | mail dave@dave.com" and off it should go. If you're doing any more than bash, the php, perl, ruby etc... have their own mail() routines.
 
Old 07-29-2009, 12:25 AM   #3
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
I tried but failed.
I was thinking about 2 issues, and not sure if anything else is missed.
The 1st thing is about the default tight setup on "relay" by CentOS. The 2nd is from my experience in setup Outlook Express that I should input something like smpt.my_isp.com, and maybe corresponding id and password as well.

For what I have tried, I received an error message from email. Unfortunately, I am too green to decode it.

Then, I add one more line to the file /etc/mail/access
Connect:192.168.1.1 RELAY
and run the following line
makemap hash access.db < access
This time, when I tried echo "message" | mail myname@myisp.com , I still receive no email, while error message (internal email) changed from 550 & 503 to 501 Data format error.

The error message:
Quote:
From MAILER-DAEMON@host.home Wed Jul 29 02:44:14 2009
Date: Wed, 29 Jul 2009 02:44:14 +0800
From: Mail Delivery Subsystem <MAILER-DAEMON@host.home>
To: <root@host.home>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="n6SIiELw005038.1248806654/host.home"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

This is a MIME-encapsulated message

--n6SIiELw005038.1248806654/host.home

The original message was received at Wed, 29 Jul 2009 02:44:01 +0800
from host.home [127.0.0.1]

----- The following addresses had permanent fatal errors -----
<myname@myisp.com>
(reason: 553 5.1.8 <myname@myisp.com>... Domain of sender address root@host.home does not exist)

----- Transcript of session follows -----
... while talking to imsmx1.myisp.com.:
>>> DATA
<<< 553 5.1.8 <myname@myisp.com>... Domain of sender address root@host.home does not exist
550 5.1.1 <myname@myisp.com>... User unknown
<<< 503 5.0.0 Need RCPT (recipient)

--n6SIiELw005038.1248806654/host.home
Content-Type: message/delivery-status

Reporting-MTA: dns; host.home
Received-From-MTA: DNS; host.home
Arrival-Date: Wed, 29 Jul 2009 02:44:01 +0800

Final-Recipient: RFC822; myname@myisp.com
Action: failed
Quote:

Last edited by iwonder; 07-30-2009 at 02:28 AM. Reason: mistake correction
 
Old 07-29-2009, 02:56 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
You do know there's a free service that does this http://www.dyndns.com/services/dns/dyndns/ or are you keen to learn for academic reasons?
 
Old 07-29-2009, 03:25 AM   #5
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
You do know there's a free service that does this http://www.dyndns.com/services/dns/dyndns/ or are you keen to learn for academic reasons?
Well, in fact, this kind of service will be blocked from time to time somewhere on the planet.
I want to learn more so that I can have more alternatives when need.
 
Old 07-30-2009, 12:13 AM   #6
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
I have edited the sendmail.mc file, input the smtp server of my isp so that the following line is there.
define(`SMART_HOST', `smtp.myisp.com')dnl
I run make -C /etc/mail to make the above line effective.
I tried echo "message" | mail myname@myisp.com , and get the same error 553 domain does not exist.

I then tried Evolution in gui.
The setup is as simple as Outlook Express. I only input the smtp server name, with no user authentication.
Email sent and received (on another PC thru internet) instantly.
This step confirms me that the smtp server of my isp do not need authentication.
But Evolution is still not my answer cause command line can only create an email at OutBox. User must press the send button to send the email.

I start to wonder if this kind of "trouble" is made intentionally in linux world in order to discourage spam mail?
I do find some names of other smtp clients but query if this is the right direction to go (if I am intentionally discouraged to do so)?
 
Old 07-30-2009, 12:41 AM   #7
centos82
Member
 
Registered: Sep 2008
Distribution: CentOS
Posts: 75

Rep: Reputation: 16
You're on the right track with "define(`SMART_HOST', `smtp.myisp.com')dnl"

The problem looks like your ISP mail server doesn't recognize who it's getting mail from.

If you have a domain name try adding:
dnl MASQUERADE_DOMAIN(mydomain.com)dnl

or at the very least put your ISP's domain there.
 
Old 07-30-2009, 02:41 AM   #8
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by centos82 View Post
You're on the right track with "define(`SMART_HOST', `smtp.myisp.com')dnl"

The problem looks like your ISP mail server doesn't recognize who it's getting mail from.

If you have a domain name try adding:
dnl MASQUERADE_DOMAIN(mydomain.com)dnl

or at the very least put your ISP's domain there.
Thank you for your reply.
I have tried host.home/home/myisp.com in the MASQUERADE_DOMAIN line but with no luck.

I have not set up DNS so I think I don't have the needed domain name here. Am I correct? Must I set up a DNS server, or I can merely "declare" it somewhere?

The latest error message is
Quote:
----- The following addresses had permanent fatal errors -----
<myname@myisp.com>
(reason: 553 host.home does not exist)

----- Transcript of session follows -----
... while talking to smtp.myisp.com.:
>>> MAIL From:<root@host.home> SIZE=525
<<< 553 host.home does not exist
501 5.6.0 Data format error
 
Old 07-30-2009, 03:16 AM   #9
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Hello iwonder

In postfix, I had to:
  • Assign a real domain name to my computer (myhostname = mydomainname.co.uk)
  • Configure my mail service provider's smtp server name (relayhost = [smtp.mymailserviceprovider.com])
  • Configure the username and password I use to log on to my mail service provider's smtp server (smtp_sasl_password_maps = hash:/etc/postfix/password)
I understand you are using sendmail, not postfix, but you probably need to configure equivalents in sendmail.

If you don't have a real domain name to use you could ask your mail service provider what their requirements are; for security, most check that the domain name is valid. Mine does not check that the sending IP is associated with the domain name. That does suggest that you can use any valid domain name but it would be very rude to use one without permission!

Best

Charles
 
Old 07-30-2009, 03:26 AM   #10
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
Quote:
Originally Posted by iwonder View Post
<<< 553 5.1.8 <myname@myisp.com>... Domain of sender address root@host.home does not exist
Once I had the same problem using sendmail. I solved by the -f option:
Code:
echo message | /usr/sbin/sendmail -f root@host.home myname@myisp.com
 
Old 07-30-2009, 04:42 AM   #11
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by catkin View Post
Hello iwonder
...

If you don't have a real domain name to use you could ask your mail service provider what their requirements are; for security, most check that the domain name is valid. Mine does not check that the sending IP is associated with the domain name. That does suggest that you can use any valid domain name but it would be very rude to use one without permission!
Best
Charles
Thanks Charles for your reply. I tends to believe the job shouldn't be that tedious cause I can can use Evolution to do it in a very simple way. Unless, Evolution do "some part" of dns server job at the background. I don't know, but I guess not.
 
Old 07-30-2009, 04:53 AM   #12
iwonder
LQ Newbie
 
Registered: Aug 2007
Location: Hong Kong
Distribution: Debian, ArchLinux, CentOS
Posts: 17

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by colucix View Post
Once I had the same problem using sendmail. I solved by the -f option:
Code:
echo message | /usr/sbin/sendmail -f root@host.home myname@myisp.com
Great. Million Thanks.
I change it a little bit to
Code:
echo message | /uer/sbin/sendmail -f myname@myisp.com myname@hotmail.com
and it works !!!

A note for other readers is to beware that the 1st email will be grouped under "JUNK" by Hotmail. Don't miss it.
 
  


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
Send mail to root but it send to other email smart_jija Solaris / OpenSolaris 5 07-01-2009 02:33 AM
Send email to specific SMTP servers per email from my server? neilius Linux - Server 6 06-25-2009 07:31 AM
Apache virtual host send email without email server SibLiant Linux - Software 6 06-03-2009 10:46 PM
Send simple email message in C zaichik Programming 5 09-09-2005 11:27 AM
Allowing an IP to send email using my email server... culprit Linux - Networking 7 09-09-2003 01:24 PM


All times are GMT -5. The time now is 04:44 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration