Use php mail function with 2 different smtp servers
UNIX systems. On Windows it delivers directly to an SMTP server, while on a UNIX system it uses a local command to hand off to the system's own MTA. The upshot ...
I made a bash script. I sure that it can be much better but at least it works. This should be set as a sendmail_path.
read -r recipient if [[ $recipient = *'@newcbl.ru' ]]; then echo -e $recipient"\n""$(</dev/stdin)" | msmtp -tC /etc/msmtprc_cbl else echo -e $recipient"\n""$(</dev/stdin)" | msmtp -t fi
When it comes to contact form setup, you can use two basic functions – either PHP mail() or SMTP authentication.
The first one sends emails on behalf of the server your domain is hosted on. However, there is no need even to create an email address, as the server does not require it to use the address in the From field.
Unlike PHP mail(), SMTP authentication allows you to use a third-party email account with your contact form. The main thing here is to configure the connection properly, that is to set the corresponding email server, port, username and password.
Below you can find the list of different CMS and the way PHP mail()/SMTP authentication can be set up:
Click Here to Visit