LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to use sendmail utility in UNIX environment (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-use-sendmail-utility-in-unix-environment-816827/)

sdiptanil 06-28-2010 12:04 PM

Unable to use sendmail utility in UNIX environment
 
Hi All,
This is in relation to the usage of sendmail utility in UNIX environment. Any help would be highly appreciated.
The issue is as follows :
In order to use the sendmail utility, I created a text file as xxx.txt with the following entries:
From:abc@abc.com
To:to@to.com
Subject:This is the subject

Then from the command line I ran the following command :
/usr/lib/sendmail -t -i << EOM
Then something like > came as a return where I wrote `cat xxx.txt`
Then again something as > appeared where I put EOM and then the command prompt retuned back. However, I failed to receive any mail.
Could anyone kindly correct me, if I am wrong somewhere ?
Thanks a lot in advance,

zirias 06-28-2010 12:18 PM

This isn't really a problem with sendmail but with your understanding of the shell's heredoc syntax. you should probably read up a little on that.

A hint: any sendmail compatible MTA expects the WHOLE mail on stdin when called the way you do it. So you could do something like that:

Code:

# cat - | sendmail -t -i
From: foobar
To: test@example.com
Subject: lalala

This is the mail body.
[Ctrl-D]
#

When using heredoc to provide the input to sendmail, all this input has to be given LITERALLY before the end marker of the heredoc ... the ">" prompt indicates that the shell expects more input as the command is not complete yet.


All times are GMT -5. The time now is 02:31 AM.