• Hi, I already configured my smtp to send emails, I tried to send the test email and it said that everything was ok, but when I want to send a email like this

    $to = 'steven@toolsnet.mx';
    $subject = $_POST['subject'];
    $messaje = "Telefono: $_POST[phone]\r\n$_POST[mail]";
    $headers = "From: $_POST[name] <$_POST[email]>" . "\r\n";
    echo json_encode(array('success' => true, 'result' => wp_mail($to, $subject, $message, $headers)));

    it doen’s work, the function only retur me “False”, may somebody help me??

    http://wordpress.org/extend/plugins/wp-mail-smtp/

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

    (@steven_barragan0)

    In order to send the message, I had to check what the plugin was doing and I had to copy what all what it does to send the test messaje and my code now looks like this.

    ` global $wpms_options, $phpmailer;
    if (!is_object($phpmailer) || !is_a($phpmailer, ‘PHPMailer’)) {
    require_once ABSPATH . WPINC . ‘/class-phpmailer.php’;
    require_once ABSPATH . WPINC . ‘/class-smtp.php’;
    $phpmailer = new PHPMailer();
    }

    $to = ‘steven@toolsnet.mx’;
    $subject = $_POST[‘subject’];
    $message = “Telefono: $_POST[phone]\r\n$_POST[mail]”;
    $headers = “From: $_POST[name] <$_POST[email]>” . “\r\n”;

    $data[‘messaje’] = wp_mail($to, $subject, $message, $headers);
    $data[‘success’] = true;`

    I hope it would be usefull to someone whit the same problem than me.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Mail SMTP] Test message is sent but real message don't’ is closed to new replies.