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
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之类的电子邮件,最好在收件箱中发送电子邮件。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.