我已经设置了gsuite电子邮件,并希望将其用于我的网站在某人注册时发送的电子邮件等。我已经设置了phpmailer来做到这一点。
$email = new PHPMailer();
$email->Host = "stmp.gmail.com";
$email->SMTPDebug = 2;
$email->SMTPAuth = true;
$email->SMTPSecure = "ssl";
$email->Port = 465;
$email->Username = "myemail@mydomain.com";
$email->Password = "password";
$email->AddReplyTo('myemail@mydomain.com', "My Email");
$email->SetFrom('myemail@mydomain.com', "My Email");
$email->AddAddress("email@gmail.com");
$email->AddAddress("email@live.com");
$email->Subject = "test email";
$email->MsgHTML("<a>This is test</a>");
$email->Send();
我试图更改电子邮件的主题/内容,也尝试了tls / 587,但它会将电子邮件发送到gmail,但无法发送,我想我不想错过。