简体   繁体   English

无法以HTML格式从服务器usiong php邮件发送邮件

[英]unable to send mail from server usiong php mail in html format

i am trying to send mail using php mail function it works good with below code: 我正在尝试使用php邮件功能发送邮件,它可以与以下代码配合使用:

<?php
$to = "abhwebdesign@gmail.com";
$subject = "subject";
$password="xxxxx";
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body >
<div style='width:670px;height:450px;padding:50px;background-color:#EFEFEB;'>
<div style='width:600px;height:450px;background-color:#FFFFFF;color:#105b94;font-size:20px;padding:10px'>
<img src='http://www.example.com/Images/Index/Logo.png' />
<p>Hi,</p>
<table style='color:#105b94;font-size:20px;'>
<tr>
<td><p>Thank you for registering with us.</p></td>
</tr>
<tr>
<td><br>Your password is :$password<br><br>We appreciate your interest.
</td>
</tr>
<tr>
<td><hr>Contact Us <br>Office :9999999999<br>www.example.com
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
";

// Always set content-type when sending HTML email
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";

// More headers
$headers .= 'From: Support <support@example.com>' . "\r\n";


mail($to,$subject,$message,$headers);
?>

the code works good if i remove www.example.com from above code in the line " Office :9999999999 如果我从上述代码中的“ Office:9999999999 ”行中删除www.example.com,则该代码会很好用
www.example.com " please help me. www.example.com ”,请帮助我。

I strongly recommend you to use: http://swiftmailer.org/ 我强烈建议您使用: http : //swiftmailer.org/

This includes mail headers and configurations. 这包括邮件标题和配置。 It manages all that stuff you don't want to see. 它管理所有您不想看到的东西。

Kind regards! 亲切的问候!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM