Jump to navigation Jump to search

5.3-Nano: msmtp

99 bytes added, 23:18, 27 January 2010
Minor grammar and spelling changes
{{Nav 5.3-Nano}}
'''Uniform Server and Msmtp , an SMTP client'''
It’s been a long time since I looked at SMTP clients. Generally most use the Windows registry however , but for portability that’s a no go. I finally narrowed it down to '''msmtp''' its . It's flexible, relative easy to set-up , and more importantly its it's portable.
The above While msmtp can be configured to use your ISP’s SMTP server however , that again restricts portability. The answer is to create a free account at Google Mail ('''gmail''') or '''Hotmail''' and configure msmtp to use that.
This combination allows any PHP scripts to send e-mail to your gmail account transparently. MSMTP has been integrated into Uniform Server all . All you need to do is configure the account as explained below.
== Background ==
SMTP (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 . In retaliation , ISP’s 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 that’s . That’s the price you pay.
That said , add the above solution to DtDNS and you have a real portable server.
'''''[[#top | Top]]'''''
PHP uses the default account as set in configuration file UniServer\msmtp\'''msmtprc.ini'''
Before running any PHP scripts that send mail , at least '''one account''' in this file must be configured and set as default.
The file contains three-example configurations that will suit most requirements.
'''''[[#top | Top]]'''''
=== MyISP ===
The first account, MyISP , replaces the basic sendmail settings that would have been set in the php.ini file.
It assumes your Internet service provider does not require you to authenticate. Hence all that is required is your ISP’s smtp server name and your email address.
'''''Note'':''' Other accounts are ignored. PHP will use this account to send emails and your ISP will relay them to the appropriate address.
I mentioned above that this account is restrictive because it ties you to your service provider hence , so it is not portable. However it has one advantage which is it requires a minimum of configuration.
'''''[[#top | Top]]'''''
=== Hotmail ===
The second account, Hotmail , is a free account that you need to create at the following address '''http//''' once signed up you will have an email address and password. These are required to configure your msmtp account.
'''''[[#top | Top]]'''''
=== Gmail ===
The third account, Gmail , is a free account that you need to create at the following address '''''' once signed up you will have an email address and password. These are required to configure your msmtp account.
=== General Note ===
I would recommend you sign-up to the above free accounts and try each in tern turn (change by changing the default) to determine which best suits your requirements. You can create any number of accounts , however make sure the account name is unique.
'''''[[#top | Top]]'''''
== Integration ==
You can skip this section however . However if you are interested in how msmtp integrates into Uniform Server’s architecture , read on. This section is useful for users who wish to upgrade when a newer version of msmtp is released.
'''''[[#top | Top]]'''''
* To folder: UniServer\'''msmtp'''
If you are upgrading , that’s all there is to do.
'''''[[#top | Top]]'''''
=== How it is integrated ===
There are three requirements for integration, : inform PHP where to find the msmtp executable, inform msmtp where to find it’s its configuration file. Finally , and finally inform msmtp where it’s its log file is to be located.
The configuration file is located in folder UniServer\'''msmtp''' and named '''msmtprc.ini''' (could have been any other appropriate name) This configuration file contains a path to the log file it is , specified as an absolute for path. For example:
logfile "C:/some_folder/UniServer/msmtp/sendmail.log"
'''''Note'':''' When servers are moved , this path is automatically updated.
A single line placed in php.ini configuration file caters for to the first two requirements. Line has the following format:
sendmail_path = "C:/some_folder/UniServer/msmtp/msmtp.exe --file=C:/ some_folder/UniServer/msmtp/msmtprc.ini -t"
'''''Note 1'':''' 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.
'''''Note 2'':''' When servers are moved , line sendmail_path is automatically updated reflecting the new paths.
There are three php.ini files (php.ini, php.ini_delvelopment_nano and php.ini_production_nano) that require modification, parts of the sendmail section are commented out and the above line added as shown below:
'''''Note'':''' File $usf_msmtp is defined in UniServer\unicon\main\includes\''''''. A user may delete msmtp and use an alternative hence files . So the file's existence is check first, ; this prevents error messages.
'''''[[#top | Top]]'''''
=== General note ===
At first sight , msmtp.exe looks large at 2.13 MB , however it is self contained and compares favourably with alternatives such as fake send mail sendmail. sendmail.exe (828 KB ) requires, libeay32.dll (1.06 MB ) and ssleay32.dll (208 KB ) (=2.10 MB).
'''''[[#top | Top]]'''''
== Summary ==
For a home web server or small business server , the above is a very good compromise.
However for a portable server it is ideal, include . Include this with DtDNS and you can have a portable server with email capability on-line within ten minutes with email capability.
'''''[[#top | Top]]'''''

Navigation menu