在localhost失败者上发送电子邮件

时间:2018-08-10 08:50:14

标签: php smtp phpmailer

这是我的代码:

void push(struct node**m){
    int x;
    printf("Enter value to add to lost\n");
    scanf("%d",&x);
    struct node *p;
    p = add_node(x);
    if(*m == NULL){ //de-reference the copied pointer to acquire the actual pointer
        *m = p; //same as above
    }
    else{
        p->next = *m; //same as above
        *m = p; //same as above
    }
    }

它不发送电子邮件,并引发以下错误消息:

$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
$mail->SMTPAuth = true; // authentication enabled
$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for Gmail
$mail->Host = "smtp.gmail.com";
$mail->Port = 465; // or 587
$mail->IsHTML(true);
$mail->Username = "my email";
$mail->Password = "my password";
$mail->SetFrom("example@gmail.com");
$mail->Subject = "Test";
$mail->Body = "hello";
$mail->AddAddress("example2@gmail.com");

 if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
 } else {
    echo "Message has been sent";
 }

我确定用户名和密码正确。知道怎么了吗?

请注意,我在本地主机(xampp)

0 个答案:

没有答案