PhpMailer无法通过后缀发送

PhpMailer无法通过后缀发送,php,email,phpmailer,postfix-mta,Php,Email,Phpmailer,Postfix Mta,这是我的密码。我想知道为什么没有发送电子邮件 use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'vendor/phpmailer/phpmailer/src/Exception.php'; require 'vendor/phpmailer/phpmailer/src/PHPMailer.php'; require 'vendor/phpmailer/phpmailer/src/SMTP

这是我的密码。我想知道为什么没有发送电子邮件

use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require 'vendor/phpmailer/phpmailer/src/Exception.php';
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/phpmailer/src/SMTP.php';


$messaggio = new PHPmailer();
$messaggio->isSMTP();

//settiamo su true il metodo che indica alla classe 
//il formato HTML
$messaggio->IsHTML(true);
$messaggio->Charset = 'UTF-8';
$messaggio->Host='mail.example.com'; 
$messaggio->SMTPSecure = '';
$messaggio->SMTPAuth = true;
$messaggio->Username = 'webmaster@example.com';
$messaggio->Password = 'AM19720306*';
$messaggio->Port = 25;
//intestazioni e corpo dell'email
$messaggio->From='webmaster@example.com';
$messaggio->FromName = "Webmaster";
$messaggio->AddAddress('amaranga72@hotmail.com');
$messaggio->AddReplyTo('webmaster@example.it'); 
$messaggio->Subject='Benvenuto Nel Nostro Sito';

//inseriamo i tag HTML e i CSS per formattare il messaggio
$messaggio->Body = '<html><body><head><style>';
$messaggio->Body .= '.up{background-color:#FF0000;color:#000000;font-         size:12px;font-weight:bold}';
$messaggio->Body .= '.down{color:#FF0000;text-align:left;font-size:12px}';   
$messaggio->Body .= '</style></head>';
$messaggio->Body .= '<img '
    . 'src="/http://localhost/home/albertyno/NetBeansProjects/PhpMail/TecnoLogo2Rid.gif.jpg" alt="logo TS"/>';
$messaggio->Body .= '<center><table><tr><td class="up">Buongiorno Utente</td></tr>';
$messaggio->Body .= '<tr><td class="down">ciao!!!</td></tr></table></center>';
$messaggio->Body .= '<table><tr><td style="font-weight:bold">Alberto Marangoni</td></tr>';
$messaggio->Body .= '<tr><td>Via Manzoni, 9</td></tr>';
$messaggio->Body .= '<tr><td>20080 Vermezzo (MI)</td></tr>';
$messaggio->Body .= '<tr><td>Tel.: 0248403353</td></tr>';
$messaggio->Body .= '<tr><td>Fax : 0248400342</td></tr>';
$messaggio->Body .= '<tr><td>Cell: 327.......</td></tr>';
$messaggio->Body .= '<tr><td>Email: alberto-marangoni@tecno02.com</td></tr>';
$messaggio->Body .= '</body></html>';


//parte relativa all'invio
if(!$messaggio->Send()){ 

   echo $messaggio->ErrorInfo; 
}else{ 
   echo 'Email inviata correttamente!';
}
使用PHPMailer\PHPMailer\PHPMailer;
使用PHPMailer\PHPMailer\Exception;
需要“vendor/phpmailer/phpmailer/src/Exception.php”;
需要“vendor/phpmailer/phpmailer/src/phpmailer.php”;
需要“vendor/phpmailer/phpmailer/src/SMTP.php”;
$messaggio=新的PHPmailer();
$messaggio->isSMTP();
//塞蒂亚莫·苏真的是我的朋友
//il格式HTML
$messaggio->IsHTML(正确);
$messaggio->Charset='UTF-8';
$messaggio->Host='mail.example.com';
$messaggio->SMTPSecure='';
$messaggio->SMTPAuth=true;
$messaggio->Username=webmaster@example.com';
$messaggio->密码='AM19720306*';
$messaggio->端口=25;
//intestazioni e corpo dell’电子邮件
$messaggio->From=webmaster@example.com';
$messaggio->FromName=“网站管理员”;
$messaggio->AddAddress('amaranga72@hotmail.com');
$messaggio->AddReplyTo('webmaster@example.it'); 
$messaggio->Subject='Benvenuto Nel Nostro Sito';
//inseriamo i标记HTML e i CSS每格式信息
$messaggio->Body='';
$messaggio->Body.='.up{背景色:#FF0000;颜色:#000000;字体大小:12px;字体重量:粗体}';
$messaggio->Body.='.down{color:#FF0000;文本对齐:左;字体大小:12px}';
$messaggio->Body.='';
$messaggio->Body.='';
$messaggio->Body.='Buongiorno Utente';
$messaggio->Body.=“再见!!!”;
$messaggio->Body.='Alberto Marangoni';
$messaggio->Body.='Via Manzoni,9';
$messaggio->Body.='20080 Vermezzo(密歇根州)';
$messaggio->Body.=“电话:0248403353”;
$messaggio->Body.=“传真:0248400342”;
$messaggio->Body.=“单元格:327…”;
$messaggio->Body.=“电子邮件:alberto-marangoni@tecno02.com';
$messaggio->Body.='';
//相对党
如果(!$messaggio->Send()){
echo$messaggio->ErrorInfo;
}否则{
回音“电子邮件因维塔科雷塔门特!”;
}
我使用postfix和phpmailer


我做错了什么?

我认为它不起作用,因为您没有设置真正的电子邮件,我从class='class1'中看到
webmaster@example.com';在您的代码中。因此,我建议您首先将此更改为您的域上的电子邮件,并调整代码中的所有参数。
我们无法向您发送已解决的代码,因为我们不知道您的域、电子邮件等。
我希望有帮助:)

谢谢,奥利弗这是SMTP给我的错误:

2019-01-20 07:25:57 Connection: opening to mail.example.com:25, timeout=300, options=array()
2019-01-20 07:25:57 Connection failed. Error #2: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known [/home/albertyno/NetBeansProjects/PhpMail/vendor/phpmailer/phpmailer/src/SMTP.php line 326] 
2019-01-20 07:25:57 Connection failed. Error #2: stream_socket_client(): unable to connect to mail.example.com:25 (php_network_getaddresses: getaddrinfo failed: Name or service not known) [/home/albertyno/NetBeansProjects/PhpMail/vendor/phpmailer/phpmailer/src/SMTP.php line 326] 
2019-01-20 07:25:57 SMTP ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed: Name or service not known (0) 
2019-01-20 07:25:57 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting. 
你能不能解决它