Find the answer to your Linux question:
Results 1 to 5 of 5
Hello everybody! I am trying to send an email from a script (say, bash). I don't want to (and can't) setup a server for sending the message. Is there something ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    5

    Send an email from a shell script


    Hello everybody!

    I am trying to send an email from a script (say, bash). I don't want to (and can't) setup a server for sending the message. Is there something like Thunderbird/Evolution/etc. that I can use from the command line. That is, I give the address of the SMTP, port, user, pass, etc. and it sends the email. I googled it and also searched the forums, but only found info on how to setup and use postfix/sendmail. Is this the only possibility?

    Thanks in advance!

    Not sure if this is the right section, if not, please move it.

  2. #2
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    522
    This should do it:
    Code:
    echo "Here goes email body" | mail -s "Here Goes The Subject" receiver@receiveraddress.whatever
    But it will come from your IP.

  3. #3
    Just Joined!
    Join Date
    Jun 2006
    Posts
    5
    Thanks for the reply, pavlo!

    I had already tried that. `mail' uses sendmail/postfix to deliver the message, doesn't it? I get the following "warning" and no message gets delivered.
    Code:
    [~] $ echo foo | mail -s subject goo@bar.com
    postdrop: warning: unable to look up public/pickup: No such file or directory

  4. #4
    Linux Enthusiast
    Join Date
    Jul 2005
    Location
    Maryland
    Posts
    522
    Quote Originally Posted by Blender View Post
    Code:
    [~] $ echo foo | mail -s subject goo@bar.com
    postdrop: warning: unable to look up public/pickup: No such file or directory
    If you haven't figured it out yet, take a look at these posts:
    Postfix 0308: Re: unable to look up public/pickup: No such file or directory
    Postfix 0308: Re: unable to look up public/pickup: No such file or directory

  5. #5
    Just Joined!
    Join Date
    Jun 2006
    Posts
    5
    Starting the daemon fixed the problem.
    Thanks!

Posting Permissions

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