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:user-guide:services:smtp.client [2018/02/17 20:16] – ↷ Page moved from doc:howto:smtp.client to docs:user-guide:services:smtp.client bobafetthotmail | docs:guide-user:services:email:smtp.client [2024/12/14 22:55] – formatting 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 mailsend ===== | ||
| Line 21: | Line 24: | ||
| ==== Description ==== | ==== Description ==== | ||
| - | < | ||
| Mailsend is a simple command line program to send mail via SMTP protocol. | Mailsend is a simple command line program to send mail via SMTP protocol. | ||
| - | </ | ||
| - | Being quite lightweight and not requiring any configuration, | + | Being quite lightweight and not requiring any configuration, |
| + | |||
| + | [[https:// | ||
| ==== Installation ==== | ==== Installation ==== | ||
| Line 31: | Line 34: | ||
| 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: | 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 | ||
| + | </ | ||
| ==== Usage ==== | ==== Usage ==== | ||
| Line 38: | Line 43: | ||
| Simple usage: | Simple usage: | ||
| - | < | + | < |
| mailsend -f root@openwrt -t foo@example.com -smtp smtp.example.com -sub "My subject" | mailsend -f root@openwrt -t foo@example.com -smtp smtp.example.com -sub "My subject" | ||
| </ | </ | ||
| - | For advanced usage (MIME attachements, authentication, | + | For advanced usage (MIME attachments, authentication, |
| < | < | ||
| Line 48: | Line 53: | ||
| mailsend -example | mailsend -example | ||
| </ | </ | ||
| + | |||
| ===== Using msmtp ===== | ===== Using msmtp ===== | ||
| Line 53: | Line 59: | ||
| ==== Description ==== | ==== Description ==== | ||
| - | < | + | msmtp is an SMTP client. |
| - | msmtp is an SMTP client. In the default mode, it transmits a mail to | + | In the default mode, it transmits a mail to an SMTP server (for example at a free mail provider) which does the delivery. |
| - | an SMTP server (for example at a free mail provider) which does the | + | To use this program with your mail user agent (MUA), create a configuration file with your mail account(s) and tell your MUA to |
| - | 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 / | call msmtp instead of / | ||
| - | </ | ||
| Since msmtp understands standard sendmail options, it can be used in places where sendmail is expected (e.g. PHP code). | Since msmtp understands standard sendmail options, it can be used in places where sendmail is expected (e.g. PHP code). | ||
| + | |||
| + | [[https:// | ||
| ==== Installation ==== | ==== Installation ==== | ||
| - | < | + | < |
| + | opkg install msmtp-mta | ||
| + | </ | ||
| + | |||
| + | Installing '' | ||
| ==== Configuration ==== | ==== Configuration ==== | ||
| - | Place your configuration | + | For router |
| - | Here is an example configuration using Fastmail' | + | <code - / |
| + | default: admin@example.com | ||
| + | </ | ||
| - | < | + | Place your configuration |
| - | # Example for a system wide configuration file | + | |
| - | # A system wide configuration file is optional. | + | Here is an example configuration using Gmail that works with 2FA and an app password: |
| - | # If it exists, it usually defines a default account. | + | |
| - | # This allows msmtp to be used like / | + | |
| - | account previous_default | + | |
| - | # The SMTP smarthost. | + | <code bash / |
| - | host mailhub.oursite.example | + | # A system wide configuration file. |
| + | # It defines a default account. | ||
| + | # This allows msmtp to be used like / | ||
| - | # Construct envelope-from addresses of the form " | + | # Set default values. |
| - | #auto_from on | + | defaults |
| - | #maildomain oursite.example | + | aliases |
| - | + | ||
| - | # Use TLS. | + | |
| - | #tls on | + | |
| - | # | + | |
| - | + | ||
| - | # Syslog logging with facility LOG_MAIL instead of the default LOG_USER. | + | |
| syslog LOG_MAIL | syslog LOG_MAIL | ||
| - | #////// | ||
| - | |||
| - | |||
| - | account default | ||
| - | |||
| - | host mail.messagingengine.com | ||
| - | from something@your-domain.tld | ||
| + | # 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 | auth on | ||
| - | user something@your-domain.tld | ||
| - | password your-password-here | ||
| - | |||
| tls on | tls on | ||
| tls_starttls off | 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 | ||
| </ | </ | ||
| - | The part below '' | + | Now symlink |
| - | Unless | + | Also you may configure env variables |
| ==== Sending mail ==== | ==== Sending mail ==== | ||
| - | < | ||
| - | Note that // | + | <code bash> |
| + | echo -e " | ||
| + | echo -e " | ||
| + | </ | ||
| + | |||
| + | Note that the // | ||
| + | |||
| + | Use '' | ||
| + | < | ||
| + | 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=' | ||
| + | </ | ||
| Line 122: | Line 136: | ||
| ==== 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 ===== | ===== Using ssmtp ===== | ||
| ==== Description ==== | ==== Description ==== | ||
| - | < | + | A secure, effective and simple way of getting mail off a system to your mail hub. |
| - | A secure, effective and simple way of getting mail off a system to your | + | It contains no suid-binaries or other dangerous things - no mail spool to poke around in, and no daemons running in the background. |
| - | mail hub. It contains no suid-binaries or other dangerous things - no | + | mail is simply forwarded to the configured mailhost. Extremely easy configuration. |
| - | mail spool to poke around in, and no daemons running in the background. | + | |
| - | mail is simply forwarded to the configured mailhost. Extremely easy | + | [[https:// |
| - | configuration. | + | |
| - | </code> | + | |
| ==== Installation ==== | ==== Installation ==== | ||
| - | < | + | < |
| + | opkg install ssmtp | ||
| + | </ | ||
| ==== Usage ==== | ==== Usage ==== | ||
| Line 170: | Line 192: | ||
| ssmtp expects its two configuration files named ''/ | ssmtp expects its two configuration files named ''/ | ||
| - | |<code> | + | < |
| - | # / | + | |
| root=arnold@gmx.net | root=arnold@gmx.net | ||
| mailhub=mail.gmx.net: | mailhub=mail.gmx.net: | ||
| Line 179: | Line 200: | ||
| UseTLS=YES | UseTLS=YES | ||
| # | # | ||
| - | </ | + | </ |
| - | |<code> | + | < |
| - | # / | + | |
| # Format: local_account: | # Format: local_account: | ||
| root: | root: | ||
| - | </ | + | </ |
| To use the program, with SMTP auth: | To use the program, with SMTP auth: | ||
| Line 191: | Line 211: | ||
| <code bash> | <code bash> | ||
| cat /etc/banner | ssmtp -vvv -auultranerd@universum.tb -ap123password456 someguy@gmx.net | cat /etc/banner | ssmtp -vvv -auultranerd@universum.tb -ap123password456 someguy@gmx.net | ||
| - | </ | + | </ |
| + | |||
| + | |||
| + | ===== 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 ==== | ||
| + | |||
| + | Enable the applet during compilation in menuconfig: '' | ||
| + | Additionally you may want to enable [[https:// | ||
| + | |||
| + | ==== Usage ==== | ||
| + | You need to configure '' | ||
| + | Instead of the variable you may use an option '' | ||
| + | |||
| + | You may also need '' | ||
| + | |||