Kangry.com [insert cool graphic here]
home | Topics | Logout | Search | Contact | ?? Kangry ?? | Bandwitdh
Topics:
DVR
nvrec
Mplayer
Links
Misc
Commands
Humor

Name

Password

New user

uploaded files
(linux_command_line)-> (Parent)->sendmail command line with subject example linux submited by Russell Thu 22 Dec 05
Edited Thu 03 May 12
Web kangry.com
in responce to a hit from Google

send mail on the command line:

$ /usr/sbin/sendmail email-address
enter body of message
CTRL-D
The CTRL-D is a end of message code for standard-in.

That is generaly useless, because the resulting message is very sparce.
From your-email-address  Thu Dec 22 12:40:17 2005
Date: Thu, 22 Dec 2005 12:40:17 -0500 (EST)
From: your-email-address (Your name)
To: undisclosed-recipients:;

enter body of message
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: user@domain.com
subject: subject
from: your-name@domain.com

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 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);
Now that I showed you how to do it, Don't spam me ;-)

sendmail manpage



Replys:
Good information.. (Karthick)
Thanks (Ryan)
Thanks, man! (win clay)
Very useful info!! Thanks! (vobadm)
not work (Anonymous)
Thank you (Anonymous)
(Anonymous)
Or call from a Korn shell script (Emkay)
Sendmail (Sonia )
sendmail from php (mosso/rackspace) (Russell)
Thanks for the info (Seltplopy)
Sendmail command (Darwin Acevedo)
Cool (Anonymous)
thanks (Sam)

Add comment or question...:
Subject:
Submited by: NOT email address. Leave blank for anonymous    (Spam Policy)

Enter Text: (text must match image for posting)




This file (the script that presented the data, not the data itself) , last modified Wednesday 03rd of December 2014 09:40:39 AM
your client: CCBot/2.0 (http://commoncrawl.org/faq/)
current time: Friday 19th of December 2014 06:23:29 PM