How can I send an email from the command line?
mierda tuti
mierdatuti at gmail.com
Sun Mar 2 17:43:47 UTC 2008
Thanks for all.
I've finished installing postfix and mailx and Ive configured a realy gmail
server.
Thanks to all
2008/3/2, Hal Burgiss <hal at burgiss.net>:
>
> On Sat, Mar 01, 2008 at 08:27:53PM -0600, Dan Farrell wrote:
> >
> > if you apt-get install mailx, chances are you'll be able to use the
> > mail command as such:
> > $ mail dan at spore.ath.cx
> > and type the subject, mail, then a . on a line by itself to terminate
> > the message. if you are really hard core, you can talk directly to the
> > recipient's smtp server. I emailed you an example. (using that
> > technique! :) )
>
>
> From within a script, it would be easier to something like ...
>
>
> echo "this is a test" | mail -s "My Subject" to at example.com
>
> Or you can 'cat' a file to the mail command in the same manner.
>
> Alternately, if there is a MTA installed (eg sendmail, or postifx),
> this would work without a mailx package installed:
>
> ( echo "From: $from"
> echo "To: $to"
> echo "Subject: $subject"
> ! [ "$replyto" == "" ] && echo "Reply-To: $replyto"
> ! [ "$cc" == "" ] && echo "Cc: $cc"
> ! [ "$bcc" == "" ] && echo "Bcc: $bcc"
> ! [ "$x_lines" == "" ] && echo "$x_lines"
> if $HTML; then
> echo "MIME-Version: 1.0"
> echo "Content-Type: text/html; charset=\"ISO-8859-1\""
> fi
> # Add required blank line to separate header/body.
> echo
> # Body goes now which we pull out of a saved textfile ...
> cat $mail_body_file
> ) | /usr/sbin/sendmail -oi -t
>
>
> And, mutt also has a commandline interface, and can do things like
> send attachments (IIRC).
>
> --
>
> Hal
>
>
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20080302/6ebd82b6/attachment.html>
More information about the ubuntu-users
mailing list