[英]Sending SMTP emails using PHPMailer via Kimsufi Server
我有一个与Debian一起使用的Kimsufi (OVH)服务器。
我想使用PHPMailer库发送SMTP电子邮件。
我不知道用户名和密码应该是什么。
$this->mail->isSMTP(); // Set mailer to use SMTP
$this->mail->CharSet = 'UTF-8';
$this->mail->Host = 'my server ip'; // Specify main and backup SMTP servers
$this->mail->SMTPAuth = true; // Enable SMTP authentication
$this->mail->Username = ''; // SMTP username
$this->mail->Password = ''; // SMTP password
$this->mail->SMTPSecure = ''; // Enable TLS encryption, `ssl` also accepted
$this->mail->Port = 25; // TCP port to connect to
如何获得所需的用户名和密码?
用户名和密码将是发件人的电子邮件详细信息。 它询问您要通过哪个电子邮件地址通过phpmailer发送邮件。 由于phpmailer库需要SMTP用户名和密码来发送邮件并确认收件箱传递。 不仅它还需要SMTP服务器和身份验证详细信息。
在这种情况下,让我们使用个人Gmail帐户通过phpmailer发送邮件
$this->mail->isSMTP(); // Set mailer to use SMTP
$this->mail->CharSet = 'UTF-8';
$this->mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$this->mail->SMTPAuth = true; // Enable SMTP authentication
$this->mail->Username = 'gmailemail@gmail.com'; // SMTP username
$this->mail->Password = 'yourgmailpassword'; // SMTP password
$this->mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$this->mail->Port = 587; // TCP port to connect to
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.