search on lynty.com

Related Articles

sendmail

Print PDF

 

$ /usr/sbin/sendmail email-address
enter body of message
CTRL-D

The CTRL-D is a end of message code for standard-in.

----------------------------------------------------

This message is missing a useful TO: line as well as a subject. To create these you need to create a file or use a script.

date: todays-date
to: This e-mail address is being protected from spambots. You need JavaScript enabled to view it
subject: subject
from: This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Body of message goes here

Then call sendmail with that file as an input:

$ /usr/sbin/sendmail email-address < mail.txt



------------------------------------------------------

 

Or you can use the -t option  to tell sendmail to read the header of the message to figure out who to send it to.

$ /usr/sbin/sendmail -t < mail.txt

This will process the To: and CC: lines for you and send the mail to the correct addresses.

 

 

-----------------------------------------

Or call from a script:
#!/usr/bin/perl
use Time::localtime;
open (OUT,"|/usr/sbin/sendmail -t");
print OUT "From: your-email\@domain.com\n"; ## don't forget to escape the @
print(OUT "Date: ".ctime()."\n");
print(OUT "To: $email\n");
print(OUT "Subject: $subject\n");
print(OUT "\n");
print(OUT "$body\n");
close(OUT);

source:
http://kangry.com/topics/viewcomment.php?index=427

 

Related Articles+