How to use your own SMTP servers PHP-mail

I am using the PHP mail() function to send emails as shown below. I have two email servers. How can I set my code to use these two mail servers? I am running my PHP code on Linux.

 mail($currEmail, $HOT_EMAIL_SUBJECT, $body, 'From: '.$pollsConfig_senderEmail); 
+4
source share
1 answer

Use PEAR :: Mail , you can specify an SMTP server with it.

 $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $obj = Mail::factory ('smtp', array ('host' => $host, 'port' => $port)); $obj->send ($to, $headers, $body); 
+2
source

All Articles