wordpress - How to send email in php with wp_mail -


i have seen similar code in use on place, can't work...

$to = 'myeamil@gmail.com'; $subject = 'test'; $message = 'test'; $headers = 'just test'; wp_mail( $to, $subject, $message, $headers ); 

i tried with:

if (wp_mail( $to, $subject, $message )) {     echo "success"; } else {     echo "fail"; } 

nothing gets printed. missing?

i prefer not use plugin this.

this different how have it:

try {     $sent = @wp_mail( $to, $subject, $message ); } catch (exception $e) {     error_log('oops: ' . $e->getmessage()); // line testing only! }  if ( $sent ) {     error_log('hooray! email sent!'); // 1 } else {     error_log('oh. email not sent.'); // , one, } 

oh, , not work on localhost without proper setup.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -