How to send a E-Mail using the Terminal


System: BeOS, Zeta

If you want to send an E-Mail using the terminal you need to have a email account for BeMail. The terminal command to send the mail, need this account as send mail address. Then you need to activate the Mail Deamon, because the mail will be send over this service. The mail need to be available a text file.


1. Mail Account

You can read how to set up the mail account using BeMail using this tutorial here (only in german availalbe).


2. Activate Mail Deamon

To activate the mail deamon, open the termianl and typ in following command:

/boot/beos/system/servers/mail_daemon &


The & sign allow to use the terminal window after running a command. Also you don't can deactivate the deamon closing the terminal.

Attention: All programs who can use the deamon can use it without any message to you. You don't can see if the deamon is in use, so someone can send private informations and files. Be sure that the deamon is deactivated if you don't use him!

How to deactivate the deamon you can see at the end of this tutorial!



3. Send Mail

At the moment you have activate the deamon you can send a mail using the terminal:

mail -v -s "Subject" Address@Mailaddress.com < /path/to/Mailfile.txt


- To send the mail we use the command mail. To see sending the mail in verbose mode we add a "-v".

- With "-s "Subject" we add a subject fort he mail.

- Then we add the target mail adresse "Address@Mailaddress.com".

- With "< /Path/to/Mailfile.txt" we add the mailfile.
 

4. Deactivate the Mail Deamon

It is important to deactivate the Mail Deamon when you have send the mail. If you want to include this way to send mail into your own application or script activate and deactivate the deamon every time you run it.

Deactivate the Mail Deamon:

quit application/x-vnd.Be-POST


To see if the Mail Deamon is realy deactivated, you can use the Taskmanager. Press Ctr + Alt and Del to open the Taskmanager an look if the deamon is running.



Translation by Christian Albrecht (Lelldorin) January 2008
Tutorial by Christian Albrecht (Lelldorin) August 2007
Made available by BeSly, the BeOS, Haiku and Zeta Knowledgebase.