The majority of SMTP clients use the Windows registry. These are not suitable for portability. The Uniform Server uses the open source msmtp client. It's flexible, relatively easy to set up and, more importantly, it's portable. This page covers the configuration sub-menu, which allows you to configure and test the msmtp client. While msmtp can be configured to use your ISP’s SMTP server, that again restricts portability. The answer is to create a free account such as Google Mail (gmail) or Hotmail and configure msmtp to use that. This combination allows any PHP scripts to send e-mail to your account transparently. msmtp has been integrated into The Uniform Server Zero. All you need to do is configure the account as explained below. BackgroundSMTP (simple mail transport protocol) was originally designed to be an open relay where an SMTP server would accept any e-mail for forwarding. This quickly became abused by spammers. In retaliation, ISPs restricted open relaying. This means you cannot use the PHP function to directly send e-mail to a user. You either require your own mail server with all the complication that is associated with it, or you use your ISP’s SMTP server. In either situation, you are restricted to a local server on a dedicated line. Free e-mail accounts such as Google Mail remove these chains by allowing you to relay through their servers. However, you must login to their servers before this privilege is granted. UpgradeThis section is useful for users who wish to upgrade when a newer version of msmtp is released. Download the latest version from https://marlam.de/msmtp/download/
Note: msmtp-1.6.2-w32.zip was the last version compiled for Windows. That is all there is to an upgrade. How MSMTP client was integratedIf you are interested in how msmtp integrates into The Uniform Server’s architecture, read on. There are three requirements for integration:
php.ini configuration fileA single line placed in php.ini configuration file resolves the first two requirements. For example, the line has the following format: sendmail_path = "C:/some_folder/UniServerZ/core/msmtp/msmtp.exe --file=C:/some_folder/UniServerZ/core/msmtp/msmtprc.ini -t" However, for portability, environment variable ${US_ROOTF} is used for paths. The actual line is shown below: sendmail_path = "${US_ROOTF}/core/msmtp/msmtp.exe --file=${US_ROOTF}/core/msmtp/msmtprc.ini -t" Note: Absolute paths with forward slashes are used. The first part instructs PHP where to find the msmtp executable, and the second part instructs msmtp where to find its configuration file. msmtp.ini configuration fileThe configuration file msmtprc.ini contains the log file path. This path is specified as an absolute path; for example, C:/some_folder/UniServerZ/core/msmtp/msmtp.log logfile ~\core\msmtp\msmtp.log Note: When the servers are moved, this path is automatically updated. Extract from PHP configuration file php.ini [mail function] ; For Win32 only. ; https://php.net/smtp ;SMTP = localhost ; https://php.net/smtp-port ;smtp_port = 25 ; For Win32 only. ; https://php.net/sendmail-from ;sendmail_from = me@example.com ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ; https://php.net/sendmail-path ;sendmail_path = sendmail_path = "${US_ROOTF}/core/msmtp/msmtp.exe --file=${US_ROOTF}/core/msmtp/msmtprc.ini -t" ; Force the addition of the specified parameters to be passed as extra parameters ; to the sendmail binary. These parameters will always replace the value of ; the 5th parameter to mail(). ;mail.force_extra_parameters = ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename mail.add_x_header = Off ; The path to a log file that will log all mail() calls. Log entries include ; the full path of the script, line number, To address and headers. ;mail.log = ; Log mail to syslog (Event Log on Windows). ;mail.log = syslog Note: If you wish, msmtp can be run from the Server console. --oOo--
|