【问题标题】:Sending SMTP emails using PHPMailer via Kimsufi Server通过 Kimsufi 服务器使用 PHPMailer 发送 SMTP 电子邮件
【发布时间】:2016-07-29 23:01:23
【问题描述】:

我有一个带有 Debian 的 Kimsufi (OVH) 服务器。

我想使用PHPMailer library 发送 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

如何获取所需的用户名和密码?

【问题讨论】:

    标签: php email smtp debian phpmailer


    【解决方案1】:

    用户名和密码将是发件人的电子邮件详细信息。它询问您想通过哪个电子邮件地址通过 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
    

    【讨论】:

    • 感谢@Sachin,但我不想使用个人邮件帐户发送电子邮件。我想使用我的专用服务器。这就是问题所在。
    • 如果您想在您的域中使用电子邮件地址,请在该域下创建一个电子邮件地址并设置用户名和密码,而不是谷歌。或者让我知道域会给你所有的信息来使用
    猜你喜欢
    • 2011-04-06
    • 1970-01-01
    • 2018-10-17
    • 1970-01-01
    • 1970-01-01
    • 2014-10-27
    • 1970-01-01
    • 1970-01-01
    • 2022-01-09
    相关资源
    最近更新 更多