尝试使用PHP发送邮件但未发送

时间:2017-03-16 12:20:24

标签: php email configuration debian sendmail

我尝试使用来自PHP的地址邮件发送电子邮件,但邮件未送达。这是日志:

Mar 15 23:11:30 vps-**** sendmail[5519]: v2FMBUKG005519: Authentication-Warning: vps-21663.fhnet.fr: www-data set sender to mywebsite@site.com using -f

Mar 15 23:11:30 vps-**** sendmail[5519]: v2FMBUKG005519: from=mywebsite@site.com, size=633, class=0, nrcpts=1, msgid=<58c9bc127f710@site.com>, relay=www-data@localhost

Mar 15 23:11:30 vps-**** sm-mta[5520]: v2FMBU6A005520: from=<mywebsite@site.com>, size=830, class=0, nrcpts=1, msgid=<58c9bc127f710@site.com>, proto=ESMTP, daemon=MTA-v4, relay=vps-****.****.fr [127.0.0.1]

Mar 15 23:11:30 vps-**** sendmail[5519]: v2FMBUKG005519: to=myemail@outlook.com, ctladdr=mywebsite@site.com (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30633, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (v2FMBU6A005520 Message accepted for delivery)

我是新手,我有几个关于邮件的问题。 我有一封地址邮件:no-reply@site.com。

我需要使用哪个服务器smtp?

我们配置要使用的邮件,密码,端口......?

因为我已经在PHP中配置了所有内容,但是我需要修改我的conf php或者sendmail的配置?

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

PHP有一个电子邮件类,你可以这样做......

     // in the controller
 `$para = $usuario; 
  $asunto = "Asunto";
  $mensaje_correo = "<html lang='es'><head><title>Title</title></head>      <body>Contenido<br><a href=''> Activar </a></body></html>";                        
// to send a email with html mail, the header content-type most fixed
 $cabeceras = "MIME-Version: 1.0"."\r\n";
 $cabeceras .= 'Content-type: text/html;charset=iso-8859-1'."\r\n";
// aditional headers
 $cabeceras .= 'From: LACETEL <correo.domain.com>'."\r\n";
 //then I send email
 // the config file 
 $config['protocol'] = 'smtp'; 
 $config['mailpath'] = '/usr/sbin/sendmail';
 $config['charset'] = 'iso-8859-1';
 $config['mailtype'] = 'html';
 $config['wordwrap'] = FALSE;
 $config['protocol'] = 'smtp';
 $config['smtp_host'] = 'your host name';
 $config['smtp_port'] = your port number;
 $config['smtp_user'] = 'your mail';
 $config['smtp_pass'] = 'yor password mail';
` 

我希望它对您有用

相关问题