Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: How To: Command-Line Email as Simply as Possible

  1. #11
    Join Date
    Dec 2006
    Beans
    7,349

    Re: How To: Command-Line Email as Simply as Possible

    Hi,

    Can you confirm that gmail has changed to the Equifax Secure CA now after the problem of the expired cert?

    Andrew
    You think that's air you're breathing now?

  2. #12
    Join Date
    Mar 2007
    Beans
    212

    Re: How To: Command-Line Email as Simply as Possible

    Quote Originally Posted by r.stiltskin View Post
    I can't find heirloom-mailx either. Anybody know where to find it?
    I recently found this and i am trying to do the same thing. 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.

  3. #13
    Join Date
    Nov 2006
    Beans
    410
    Distro
    Xubuntu

    Re: How To: Command-Line Email as Simply as Possible

    Quote Originally Posted by DFord425 View Post
    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");

  4. #14
    Join Date
    Feb 2007
    Beans
    2

    Re: How To: Command-Line Email as Simply as Possible

    Thanks for this info and for the helpful comments afterwards. This saved me alot of time.

    heirloom-mailx seems to be just called mailx now

    Code:
    sudo apt-get install mailx
    should do the trick

  5. #15
    Join Date
    Apr 2009
    Beans
    4

    Re: How To: Command-Line Email as Simply as Possible

    Thank you for the detailed directions. I think I have followed them carefully and have installed mailx and mstmp.

    But when I try to send mail, I get the error message "msmtp: no recipients given". Any suggestions about what mistake I might have made? Thanks for any help.

  6. #16
    Join Date
    Nov 2006
    Beans
    410
    Distro
    Xubuntu

    Re: How To: Command-Line Email as Simply as Possible

    I don't know -- I can't find any way to produce that error message.

  7. #17
    Join Date
    Apr 2009
    Beans
    4

    Re: How To: Command-Line Email as Simply as Possible

    Update: I was able to send mail using msmtp directly but see the error message when trying to send using mailx. So there is some issue between mails and msmtp.

  8. #18
    Join Date
    Apr 2009
    Beans
    4

    Re: How To: Command-Line Email as Simply as Possible

    Resolved: I had been using mailx from the mailutils package. After I installed it from mailx, everything works.

  9. #19
    Join Date
    May 2009
    Beans
    2

    Re: How To: Command-Line Email as Simply as Possible

    Fantastic. Just what I've been looking for. Thanks for documenting this. This is something that should definitely be incorporated into the distro too - simple out of the box smtp at least.

    While these instructions work great for $USER, is anyone using a modified set for a system-wide solution or is that not possible given that, say, using gmail requires specific user settings?

    I'm asking because I only have 3 users on the machine and then root. I could set this up for the other 3 users and root as well, but wondering if there's any configuration that can be shared and what the system-level file equivalents are.

  10. #20
    Join Date
    Nov 2006
    Beans
    410
    Distro
    Xubuntu

    Re: How To: Command-Line Email as Simply as Possible

    I haven't tried it but I believe you can replace the ~/.mailrc with /etc/mail.rc and replace ~/.msmtprc with /etc/msmtprc and that should work system-wide if all users share the same isp settings.

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •