简体   繁体   English

使用PHP将邮件发送到垃圾邮件

[英]Mail go to spam using PHP

I want to send mail to inbox using smtp mail method using PHP.Now mail go to spam instead of inbox,i am using smtp mail method.I had set the hostname,username and password.Included the class.phpmailer.Mail body contain HTML content. 我想使用PHP使用smtp邮件方法将邮件发送到收件箱。现在邮件转到垃圾邮件而不是收件箱,我正在使用smtp邮件方法。我已经设置了主机名,用户名和密码。包括了class.phpmailer.Mail正文包含HTML内容。

<?php

 define("SMTP_HOST", "mail.test.com"); //Hostname of the mail server
 define("SMTP_PORT", "25"); //Port of the SMTP like to be 25, 80, 465 or 587
  define("SMTP_UNAME", "tttt"); 
 //Username for SMTP authentication any valid   email created in your domain
 define("SMTP_PWORD", "tttt"); //Password for SMTP authentication
?>


Mail Code

//smtp mail
$mail   = new PHPMailer;
$mail->Host = SMTP_HOST; 
$mail->Port = SMTP_PORT; 
$mail->SMTPAuth = true; 
$mail->Username = SMTP_UNAME; 
$mail->Password = SMTP_PWORD; 
$mail->AddReplyTo("test@test.com", "test"); 
$mail->SetFrom("test@test.com", "test.com"); 
$mail->Subject = $subject; 
$mail->AddAddress($to, '');
$mail->MsgHTML($message);
$send = $mail->Send(); 
$mail->ClearAddresses();

 //smtp mail

Anybody help me? 有人帮我吗

使用发件人电子邮件发送您的域电子邮件。就像您的域名是example.com一样,如果使用这种电子邮件类型,请使用诸如info@example.com之类的电子邮件,最好在收件箱中发送电子邮件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM