Note; This is only to send email, and not receive.
- Install SSMTP
pi@raspberrypi ~ $sudo apt-get update
pi@raspberrypi ~ $sudo apt-get install ssmtp
pi@raspberrypi ~ $sudo apt-get install ssmtp
-Configure SMTP
pi@raspberrypi ~ $ sudo nano /etc/ssmtp/ssmtp.conf
Add add these lines;root=username@gmail.com
mailhub=smtp.gmail.com:465
rewriteDomain=gmail.com
AuthUser=username
AuthPass=password
FromLineOverride=YES
UseTLS=YES
Use your email address for root, and your gmail username and password for AuthUser and AuthPass.
To send an emailTo send an email, run SSMTP with the recipients name.
SSMTP will then wait for you to type your email. It has to be formatted as shown below. And once done, press Ctrl-D to send.
pi@raspberrypi ~ $ ssmtp mail.address@example.com
subject: this is a test
hellow world!
pi@raspberrypi ~ $
subject: this is a test
hellow world!
pi@raspberrypi ~ $
Send an attachment
It is also possible to send attachments. This can be done using mpack
Install mpack
pi@raspberrypi ~ $sudo apt-get install mpack
To send a file with an attachment;
pi@raspberrypi ~ $ mpack -s subject picture.png mail.address@example.com
No hay comentarios:
Publicar un comentario