Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
linux_wiki:send_email_via_gmail_smtp_cmd_line [2014/12/01 17:25] billdozor |
linux_wiki:send_email_via_gmail_smtp_cmd_line [2015/03/09 22:12] billdozor |
||
---|---|---|---|
Line 1: | Line 1: | ||
====== Send Email via Gmail SMTP Cmd Line ====== | ====== Send Email via Gmail SMTP Cmd Line ====== | ||
- | Goal: To send an e-mail message from a bash script or command line program. | ||
- | Prerequisites | + | **General Information** |
- | | + | |
- | | + | |
- | === Install msmtp === | + | Send an e-mail message from a bash script or command line program. |
+ | |||
+ | **Checklist** | ||
+ | * Distros: Debian/ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ===== Install msmtp ===== | ||
This package will allow you to configure what gmail account to send from and will connect securely via TLS to the gmail SMTP servers. | This package will allow you to configure what gmail account to send from and will connect securely via TLS to the gmail SMTP servers. | ||
Line 13: | Line 17: | ||
</ | </ | ||
- | === Install Mailx === | + | ---- |
+ | |||
+ | ===== Install Mailx ===== | ||
Install a simple mail transfer agent to actually prepare the e-mail message. | Install a simple mail transfer agent to actually prepare the e-mail message. | ||
Line 20: | Line 26: | ||
</ | </ | ||
- | === Configure Gmail Account on MSMTP === | + | ---- |
+ | |||
+ | ===== Configure Gmail Account on MSMTP ===== | ||
1) Create a file in your home directory called " | 1) Create a file in your home directory called " | ||
Line 63: | Line 71: | ||
</ | </ | ||
- | === Configure Mailx === | + | ---- |
+ | |||
+ | ===== Configure Mailx ===== | ||
Setup mailx to use msmtp to send e-mail. | Setup mailx to use msmtp to send e-mail. | ||
Line 77: | Line 87: | ||
</ | </ | ||
- | === Send mail from the command line === | + | ---- |
+ | |||
+ | ===== Send mail from the command line ===== | ||
- | ==Interactively== | + | ==== Interactively |
<code bash> | <code bash> | ||
Line 87: | Line 99: | ||
You will now be able to type in your message. When you want to send it, type ENTER to go to a blank line and then Ctrl+D to end/send. | You will now be able to type in your message. When you want to send it, type ENTER to go to a blank line and then Ctrl+D to end/send. | ||
- | ==Auto Messages== | + | ==== Auto Messages |
To send an e-mail from a script, you will need to pre-write your message. | To send an e-mail from a script, you will need to pre-write your message. | ||