• Hello,

    I’m using the function WordPress wp_mail (); and if he wants to send an email he gets an error

    Fatal error: Cannot declare class PHPMailer\PHPMailer\PHPMailer, because the name is already in use in /home/twoj-host/web/test.twoj-host.eu/public_html/wp-includes/PHPMailer/PHPMailer.php on line 32

    This is what my code looks like

    $to = $_POST['email'];
    $subject = __('Przypomnienie hasła','wyszukiwarka');
    $body = __('Witaj '.$_POST['user'].',<br /> Poprosiłeś o zmianę hasła, aby zmienić hasło kliknij w link na dole. <br /> <a href="'.get_option('home').'/?email='.$_POST['email'].'&name_user='.$_POST['user'].'" ><p></p></a>','wyszukiwarka');
    	$headers = array('Content-Type: text/html; charset=UTF-8','From:'.get_option('blogname').' <'.get_option('admin_email').'>');
    	$wyslij= wp_mail($to,$subject,$body,$headers);

    Please help

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator threadi

    (@threadi)

    The code you wrote does not show any cause for the error. The reason for the error is that the mailer library phpmailer used by WordPress is apparently integrated several times. Have you possibly activated a plugin that integrates further mail functionalities? Or does the code you wrote contain more than just these few lines?

    Thread Starter shryus

    (@shryus)

    I mean I have a plugin written by me and I have phpmailer in the plugin

    Moderator threadi

    (@threadi)

    Do without the self-built phpmailer and use the one that comes with wordpress anyway.

    Thread Starter shryus

    (@shryus)

    Ok, it will rebuild with its plug.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Error sending function wp_mail’ is closed to new replies.