WP-Mail-SMTP – Getting Mail() to Work
-
Installed plugin WP-Mail-SMTP Version 0.9.1 (“Reconfigures the wp_mail() function to use SMTP instead of mail() and creates an options page to manage the settings”).
I’m using smtp.gmail.com with the recommended settings, and it’s able to send a test email from wp-admin. That’s fine, but I’m having trouble translating that into where the email is actually being sent in the PHP program, which is called formprocessor2.php. I’ve seen the general recommendations to change mail() to wp_mail(), but I don’t really understand the specifics of how to do that. I did try changing the mail() command in formprocessor2.php to wp_mail() and got this error:
Call to undefined function wp_mail() in C:\wamp\www\testsite\rosterform\formprocessor2.php on line 86Here is the PHP code that actually sends out the mail:
`$headers = “MIME-Versin: 1.0\r\n” .
“Content-type: text/plain; charset=ISO-8859-1; format=flowed\r\n” .
“Content-Transfer-Encoding: 8bit\r\n” .
“From: My Test Company <mail@mytestcompany.com>\r\n” .
“X-Mailer: PHP” . phpversion();//ini_set(“SMTP”,”mail.mytestcompany.com”); // Mail Server
//ini_set(“smtp_port”, “25”); // SMTP Port
//ini_set(“sendmail_from”, “mail@mytestcompany.com”); //return address$result = mail(implode(“,”, $recipients), $subject, $mail_body, $headers); //mail command`
The topic ‘WP-Mail-SMTP – Getting Mail() to Work’ is closed to new replies.