如何从托管服务1和1中查找信息以便使用PHP邮件发送电子邮件?

问题描述 投票:0回答:1

我目前有一个使用PHPmailer发送电子邮件的网站。我用1和1.fr托管它,但无法找到信息以便实际发送电子邮件。以下是我需要的以下信息:

$mail->SMTPDebug = 2;                                 // Enable verbose debug output
$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'smtp1.example.com;smtp2.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = '[email protected]';                 // SMTP username
$mail->Password = 'secret';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

在1&1.fr网站上,他们提供以下信息:

server info

在图像中,它们指定多个端口以及入口/出口服务器;我应该选择哪些进入我的PHP文件。

我的其余代码工作正常(当我使用000webhost使用我的Gmail帐户时它可以工作)。

任何帮助将不胜感激。

php hosting phpmailer web-hosting
1个回答
0
投票
// define the $mail // just in case you miss it as it is missing in your code.
$mail = new PHPMailer();

// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;    // this is to enable debug if there are errors

$mail->isSMTP();         //Tell PHPMailer to use SMTP

//Set the hostname of the mail server
$mail->Host = 'auth.smtp.1and1.fr';

// Enable authentication so you must provide username and password for SMTP authentication
$mail->SMTPAuth = true;  

$mail->Username = '[email protected]';     // SMTP username
$mail->Password = 'secret';               // SMTP password

$mail->SMTPSecure = 'tls';                // Here you are telling to use a secure connection with TLS/SSL

//Set the SMTP port number
$mail->Port = 587; // if specified tls. try also 465 as defined in the picture you post

// TCP port for secure connections. 465 is the secure port for outgoing 
// emails and 993 is for incoming email using IMAP. If you use POP3 the 
//incoming emails are received on 995 port number.

希望现在更清楚了。

© www.soinside.com 2019 - 2024. All rights reserved.