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 [2018/03/03 20:15] – ↷ Page moved from docs:user-guide:services:email:smtp.client to docs:guide-user:services:email:smtp.client bobafetthotmail | 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 ^ Dependencies ^ Size ^ Features | + | ^ Name |
| - | | msmtp | 1.6.2-1 | //libopenssl// | 37785 | SSL, smarthost only, sendmail-compatible, | + | | [[docs: |
| - | | msmtp-nossl | 1.6.2-1 | | 33503 | smarthost only, sendmail-compatible, | + | | [[packages: |
| - | | mailsend | 1.17b15-2 | + | | [[packages: |
| - | | mailsend-nossl | 1.17b15-2 | + | | [[packages: |
| - | | ssmtp | 2.64-1.1 | // | + | | [[packages: |
| - | | mini-sendmail | //not present on CC// | | 4726 | smarthost only, no configuration required | | + | | [[packages: |
| + | | mini-sendmail | ||
| + | | [[packages: | ||
| + | | [[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 ==== |
| - | ==== Installation ==== | + | ssmtp expects its two configuration files named '' |
| - | < | + | |
| - | ==== Configuration ==== | + | <code bash / |
| - | Place your configuration in '' | + | root=arnold@gmx.net |
| + | mailhub=mail.gmx.net: | ||
| + | rewriteDomain=gmx.net | ||
| + | hostname=gmx.net | ||
| + | FromLineOverride=YES | ||
| + | UseTLS=YES | ||
| + | # | ||
| + | </code> | ||
| - | Here is an example configuration using Fastmail' | + | <code bash / |
| + | # Format: local_account: | ||
| + | root: | ||
| + | </ | ||
| - | < | + | To use the program, with SMTP auth: |
| - | # Example for a system wide configuration file | + | |
| - | # A system wide configuration file is optional. | + | <code bash> |
| - | # If it exists, it usually defines a default account. | + | cat /etc/banner | ssmtp -vvv -auultranerd@universum.tb -ap123password456 someguy@gmx.net |
| - | # This allows msmtp to be used like /usr/sbin/ | + | </ |
| - | account previous_default | + | |
| - | # The SMTP smarthost. | ||
| - | host mailhub.oursite.example | ||
| - | # Construct envelope-from addresses of the form " | + | ===== Using BusyBox sendmail ===== |
| - | #auto_from on | + | |
| - | #maildomain oursite.example | + | |
| - | # Use TLS. | + | - [[https:// |
| - | #tls on | + | - [[https://git.busybox.net/busybox/tree/ |
| - | # | + | |
| - | # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. | + | ==== Description ==== |
| - | syslog LOG_MAIL | + | |
| - | #////// | + | |
| + | The BusyBox sendmail is a smallest possible implementation but it must be compiled. It works only in smarthost mode. | ||
| - | account default | + | ==== Installation ==== |
| - | host mail.messagingengine.com | + | Enable the applet during compilation in menuconfig: '' |
| - | from something@your-domain.tld | + | Additionally you may want to enable [[https:// |
| - | auth on | + | ==== Usage ==== |
| - | user something@your-domain.tld | + | You need to configure '' |
| - | password your-password-here | + | Instead of the variable you may use an option '' |
| - | tls on | + | You may also need '' |
| - | tls_starttls off | + | |
| + | |||
| + | ===== Using mailsend ===== | ||
| + | |||
| + | ==== Description ==== | ||
| + | |||
| + | Mailsend is a simple command line program to send mail via SMTP protocol. | ||
| + | |||
| + | Being quite lightweight and not requiring any configuration, | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ==== Installation ==== | ||
| + | |||
| + | Depending | ||
| + | |||
| + | < | ||
| + | opkg install mailsend | ||
| + | opkg install mailsend-nossl | ||
| </ | </ | ||
| - | The part below '' | + | ==== Usage ==== |
| - | Unless you happen to use Fastmail, replace '' | + | Simple usage: |
| - | ==== Sending mail ==== | + | < |
| - | < | + | mailsend |
| + | </ | ||
| + | |||
| + | For advanced usage (MIME attachments, | ||
| + | |||
| + | < | ||
| + | mailsend -h | ||
| + | mailsend -example | ||
| + | </ | ||
| - | Note that // | ||
| Line 122: | 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 | ||
| - | </ | ||