Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:services:email:smtp.client [2022/12/03 21:00] – [Table] xxiao | docs:guide-user:services:email:smtp.client [2024/12/14 23:05] – move old clients to bottom stokito | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| ===== Overview ===== | ===== Overview ===== | ||
| - | The table below is based on Chaos Calmer (15.05). | + | The table shows all clients ported to OpenWrt: |
| - | ^ Name ^ Version | + | ^ Name ^ Version |
| - | | [[docs: | + | | [[docs: |
| - | | [[packages: | + | | [[packages: |
| - | | msmtp-nossl | + | | [[packages: |
| - | | mailsend | + | | [[packages: |
| - | | mailsend-nossl | + | | [[packages: |
| - | | ssmtp | 2.64-1.1 | + | | [[packages: |
| - | | mini-sendmail | + | | mini-sendmail |
| - | | [[packages: | + | | [[packages: |
| - | | [[docs: | + | | [[docs: |
| - | " | + | " |
| - | ===== Using mailsend | + | ===== Using msmtp ===== |
| ==== Description ==== | ==== Description ==== | ||
| + | msmtp is an SMTP client. | ||
| + | In the default mode, it transmits a mail to an SMTP server (for example at a free mail provider) which does the delivery. | ||
| + | To use this program with your mail user agent (MUA), create a configuration file with your mail account(s) and tell your MUA to | ||
| + | call msmtp instead of / | ||
| + | |||
| + | Since msmtp understands standard sendmail options, it can be used in places where sendmail is expected (e.g. PHP code). | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ==== Installation ==== | ||
| < | < | ||
| - | Mailsend is a simple command line program to send mail via SMTP protocol. | + | opkg install msmtp-mta |
| </ | </ | ||
| - | Being quite lightweight and not requiring any configuration, | + | Installing '' |
| - | ==== Installation | + | ==== Configuration |
| + | For router configuration, | ||
| - | Depending on whether you want SSL support or not (actually, the size of libopenssl will probably be the decisive factor), install one of the two versions: | + | <code - / |
| + | default: admin@example.com | ||
| + | </ | ||
| - | < | + | Place your configuration in '' |
| - | < | + | |
| - | ==== Usage ==== | + | Here is an example configuration using Gmail that works with 2FA and an app password: |
| - | Simple usage: | + | <code bash / |
| + | # A system wide configuration file. | ||
| + | # It defines a default account. | ||
| + | # This allows msmtp to be used like / | ||
| - | < | + | # Set default values. |
| - | mailsend -f root@openwrt -t foo@example.com -smtp smtp.example.com -sub "My subject" | + | defaults |
| + | aliases / | ||
| + | syslog LOG_MAIL | ||
| + | |||
| + | # Gmail configuration that works with 2FA and an app password. | ||
| + | # Use TLS on port 465. On this port, TLS starts without STARTTLS. | ||
| + | account gmail | ||
| + | host smtp.gmail.com | ||
| + | port 465 | ||
| + | auth on | ||
| + | tls on | ||
| + | tls_starttls off | ||
| + | from_full_name Apartment Router | ||
| + | from home.lab@gmail.com | ||
| + | user home.lab@gmail.com | ||
| + | password abcd efgh ijkl mnop | ||
| + | |||
| + | # Select the default account | ||
| + | account default : gmail | ||
| </ | </ | ||
| - | For advanced usage (MIME attachements, | + | Now symlink '' |
| + | Also you may configure env variables '' | ||
| + | |||
| + | ==== Sending mail ==== | ||
| + | |||
| + | <code bash> | ||
| + | echo -e " | ||
| + | echo -e " | ||
| + | </ | ||
| + | |||
| + | Note that the // | ||
| + | |||
| + | Use '' | ||
| < | < | ||
| - | mailsend | + | Mon Oct 14 23:35:55 2024 mail.info msmtp: host=smtp.gmail.com tls=on auth=on user=******@gmail.com from=******@gmail.com recipients=admin@example.com mailsize=181 smtpstatus=250 smtpmsg=' |
| - | mailsend | + | |
| </ | </ | ||
| - | ===== Using msmtp ===== | + | |
| + | ===== Using ssmtp ===== | ||
| ==== Description ==== | ==== Description ==== | ||
| + | |||
| + | A secure, effective and simple way of getting mail off a system to your mail hub. | ||
| + | It contains no suid-binaries or other dangerous things - no mail spool to poke around in, and no daemons running in the background. | ||
| + | mail is simply forwarded to the configured mailhost. Extremely easy configuration. | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ==== Installation ==== | ||
| < | < | ||
| - | msmtp is an SMTP client. In the default mode, it transmits a mail to | + | opkg install ssmtp |
| - | an SMTP server (for example at a free mail provider) which does the | + | |
| - | delivery. To use this program with your mail user agent (MUA), create | + | |
| - | a configuration file with your mail account(s) and tell your MUA to | + | |
| - | call msmtp instead of / | + | |
| </ | </ | ||
| - | Since msmtp understands standard sendmail options, it can be used in places where sendmail is expected (e.g. PHP code). | + | ==== Usage ==== |
| + | |||
| + | ssmtp expects its two configuration files named ''/ | ||
| + | |||
| + | <code bash / | ||
| + | root=arnold@gmx.net | ||
| + | mailhub=mail.gmx.net: | ||
| + | rewriteDomain=gmx.net | ||
| + | hostname=gmx.net | ||
| + | FromLineOverride=YES | ||
| + | UseTLS=YES | ||
| + | # | ||
| + | </ | ||
| + | |||
| + | <code bash / | ||
| + | # Format: local_account: | ||
| + | root: | ||
| + | </ | ||
| + | |||
| + | To use the program, with SMTP auth: | ||
| + | |||
| + | <code bash> | ||
| + | cat /etc/banner | ssmtp -vvv -auultranerd@universum.tb -ap123password456 someguy@gmx.net | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ===== Using BusyBox sendmail ===== | ||
| + | |||
| + | - [[https:// | ||
| + | - [[https:// | ||
| + | |||
| + | ==== Description ==== | ||
| + | |||
| + | The BusyBox sendmail is a smallest possible implementation but it must be compiled. It works only in smarthost mode. | ||
| ==== Installation ==== | ==== Installation ==== | ||
| - | < | ||
| - | ==== Configuration ==== | + | Enable the applet during compilation |
| - | Place your configuration | + | Additionally |
| - | Here is an example configuration using Gmail that worlks | + | ==== Usage ==== |
| + | You need to configure '' | ||
| + | Instead of the variable you may use an option '' | ||
| - | < | + | You may also need '' |
| - | # Example | + | |
| - | # A system wide configuration file is optional. | ||
| - | # If it exists, it usually defines a default account. | ||
| - | # This allows msmtp to be used like / | ||
| - | # cat / | ||
| - | defaults | + | ===== Using mailsend ===== |
| - | account default | + | |
| - | host smtp.gmail.com | + | ==== Description ==== |
| - | port 465 | + | |
| - | auth on | + | |
| - | tls on | + | |
| - | tls_starttls off | + | |
| - | from abc@gmail.com | + | Mailsend is a simple command line program to send mail via SMTP protocol. |
| - | user abc@gmail.com | + | |
| - | password app_passwd_here | + | |
| - | syslog LOG_MAIL | + | Being quite lightweight and not requiring any configuration, |
| + | |||
| + | [[https:// | ||
| + | |||
| + | ==== Installation ==== | ||
| + | |||
| + | Depending on whether you want SSL support or not (actually, the size of libopenssl will probably be the decisive factor), install one of the two versions: | ||
| + | |||
| + | < | ||
| + | opkg install mailsend | ||
| + | opkg install mailsend-nossl | ||
| </ | </ | ||
| - | Now symlink '' | + | ==== Usage ==== |
| - | ==== Sending mail ==== | + | |
| - | < | + | Simple usage: |
| + | |||
| + | < | ||
| + | mailsend | ||
| + | </code> | ||
| + | |||
| + | For advanced usage (MIME attachments, | ||
| + | |||
| + | < | ||
| + | mailsend -h | ||
| + | mailsend -example | ||
| + | </ | ||
| - | Note that // | ||
| Line 109: | Line 200: | ||
| ==== Description ==== | ==== Description ==== | ||
| - | ^ Name ^ Version ^ Dependencies ^ Size ^ Description | + | mini_sendmail reads its standard input up to an end-of-file and sends a copy of the message found there to all of the addresses listed. |
| - | | mini-sendmail | + | The message is sent by connecting to a local SMTP server. This means '' |
| + | [[https:// | ||
| ==== Installation and Configuration ==== | ==== Installation and Configuration ==== | ||
| - | < | + | < |
| + | opkg install mini-sendmail | ||
| + | </ | ||
| On Chaos Calmer, the package is no longer available, but the version from Barrier Breaker still works (AA & BB versions as installed below work in AA): | On Chaos Calmer, the package is no longer available, but the version from Barrier Breaker still works (AA & BB versions as installed below work in AA): | ||
| - | < | + | < |
| + | opkg install http:// | ||
| + | </ | ||
| ==== Example ==== | ==== Example ==== | ||
| - | |<code bash> | + | |
| + | <code bash> | ||
| mini_sendmail -ssmtp.mail.yahoo.com -p465 -t foo@example.com < input_file | mini_sendmail -ssmtp.mail.yahoo.com -p465 -t foo@example.com < input_file | ||
| usage: mini_sendmail [-f< | usage: mini_sendmail [-f< | ||
| - | </ | + | </ |
| Note that there must not be a space between the option and the value; e.g. "-p 465" is incorrect. | Note that there must not be a space between the option and the value; e.g. "-p 465" is incorrect. | ||
| Several sample configurations found on the internet failed, but as of 160413, this worked | Several sample configurations found on the internet failed, but as of 160413, this worked | ||
| - | |<code bash> | + | <code bash> |
| echo -e 'From: valid@email.com\r\nSubject: | echo -e 'From: valid@email.com\r\nSubject: | ||
| - | </ | + | </ |
| smtp.gmail.com failed; omitting -f failed; omitting "From: " resulted in transmission, | smtp.gmail.com failed; omitting -f failed; omitting "From: " resulted in transmission, | ||
| This is a very small package if you can find an smtp server which works and you can configure the command so that the server accepts it. | This is a very small package if you can find an smtp server which works and you can configure the command so that the server accepts it. | ||
| - | ===== Using ssmtp ===== | ||
| - | ==== Description ==== | ||
| - | < | ||
| - | A secure, effective and simple way of getting mail off a system to your | ||
| - | mail hub. It contains no suid-binaries or other dangerous things - no | ||
| - | mail spool to poke around in, and no daemons running in the background. | ||
| - | mail is simply forwarded to the configured mailhost. Extremely easy | ||
| - | configuration. | ||
| - | </ | ||
| - | ==== Installation ==== | ||
| - | |||
| - | < | ||
| - | |||
| - | ==== Usage ==== | ||
| - | |||
| - | ssmtp expects its two configuration files named ''/ | ||
| - | |||
| - | |< | ||
| - | # / | ||
| - | root=arnold@gmx.net | ||
| - | mailhub=mail.gmx.net: | ||
| - | rewriteDomain=gmx.net | ||
| - | hostname=gmx.net | ||
| - | FromLineOverride=YES | ||
| - | UseTLS=YES | ||
| - | # | ||
| - | </ | ||
| - | |||
| - | |< | ||
| - | # / | ||
| - | # Format: local_account: | ||
| - | root: | ||
| - | </ | ||
| - | |||
| - | To use the program, with SMTP auth: | ||
| - | |||
| - | <code bash> | ||
| - | cat /etc/banner | ssmtp -vvv -auultranerd@universum.tb -ap123password456 someguy@gmx.net | ||
| - | </ | ||