Originally Posted by
DFord425
I cannot find heirloom-mailx or nail. I tried to use the apt-get install command for both. Also i am trying to modify the msmtrpc file but i cant find it. Does anyone know where i find it.
You don't need heirloom-mailx or nail. It turned out that mailx (included in the Ubuntu distro) works fine. As for msmtprc -- you create it.
If you need more info:
-------------------------------------------------------------------------
USING MAIL + MSMTP TO SEND EMAILS FROM A TERMINAL PROMPT OR FROM A SCRIPT:
-------------------------------------------------------------------------
mail (/usr/bin/mail) is provided by mailx or smail (smail requires mailx and uucp), and msmtp provides the interface to the isp that forwards the mail. So:
~$ sudo apt-get install msmtp smail uucp
(mailx will be installed as a dependency)
In your home directory, create a ~/.mailrc file containing just:
Code:
set sendmail=/usr/bin/msmtp
Create a config file for msmtp; mine is ~/.msmtprc but I think a systemwide /etc/msmtprc file would work as well. For my Verizon account this file consists of:
Code:
# .msmtprc ##configuration file for msmtp
#account verizon
host outgoing.verizon.net
from [from address to appear on the email]
auth login
tls off
user [username]@verizon.net
password [************]
#account default : verizon
notes:
- The lines "account verizon" and "account default : verizon" are commented out -- they seem to be unnecessary if only 1 account is listed in the file.
- The [from address ...] can be whatever you want to appear on the email; it does not have to be your isp account address.
- The line "auth login" is to be copied exactly. This "login" is NOT your username.
- You'll have to determine the appropriate entries for the host, auth, and tls lines, depending on your isp.
To send an email manually from a terminal prompt, type a first line consisting of the command, the subject and one or more recipient addresses (no commas):
Code:
~$ mail -s "the subject line" [first recipient] [second recipient] [...]
followed by <enter>.
Then type the body of the message. This can be on multiple lines (<enter> will not terminate the message).
Finally, to terminate the message, type <enter> at the end of the last message line, and then type ctrl-D at the beginning of the next line.
To send an email from, say, a perl script, include a line similar to this in the script:
Code:
system("echo \"Body of the message\" | mail -s \"Subject line\" recipient1@address1 recipient2@address2");
Bookmarks