• Resolved wpfan1000

    (@wpfan1000)


    I am getting the email address of the author of a post with

    $postauthoremail = the_author_meta('user_email');

    This does contain the correct email address.

    If I feed that into wp_mail:

    wp_mail($postauthoremail, $subject, $message);

    This does not work.

    If I hard code the email:

    wp_mail('myemail@domain.com', $subject, $message);

    This does work.

    I have tried adding quotation marks to $postauthoremail, converting it to string, etc and does not help.

    Any help is appreciated.

Viewing 1 replies (of 1 total)
  • Thread Starter wpfan1000

    (@wpfan1000)

    Resolved
    Must use:
    get_the_author_meta(‘user_email’);
    not
    the_author_meta(‘user_email’);

Viewing 1 replies (of 1 total)
  • The topic ‘wp_mail not working with to address’ is closed to new replies.