PHP:使用邮件发送链接无法正常工作
我正在建立一个网站,当用户进行注册时,我需要在其中发送电子邮件 电子邮件发送时没有问题,但在my href='link'或src='link'上,邮件中的链接断开 代码如下:PHP:使用邮件发送链接无法正常工作,php,http,email,hyperlink,phpmailer,Php,Http,Email,Hyperlink,Phpmailer,我正在建立一个网站,当用户进行注册时,我需要在其中发送电子邮件 电子邮件发送时没有问题,但在my href='link'或src='link'上,邮件中的链接断开 代码如下: <?php $to = $UserMail; $subject = 'XYZ - Account Verification'; $headers = array("From: XYZ <noreply@XYZ.net>", "Conten
<?php
$to = $UserMail;
$subject = 'XYZ - Account Verification';
$headers = array("From: XYZ <noreply@XYZ.net>",
"Content-type: text/html; charset=ISO-8859-1",
"Mime-Version: 1.0",
"Content-Transfer-Encoding: quoted-printable",
"X-Mailer: PHP/" . PHP_VERSION
);
$headers = implode("\r\n", $headers);
//define the message to be sent. Each line should be separated with \n
$IDVer = crypt($UserID, '$2a$07$YourSaltIsA22ChrString$');
$message = "<html>
<img src='https://www.example.net/path/image.png' width='1200' height='1200' alt='Logo'>
<h1> Hi " . $Username . " welcome to XYZ!</h1><br>
Please Verify your account clicking
<a href='https://www.example.net/path/?Verify=". $IDVer ."'> here</a>
</html>";
$mail_sent = SendEmail($to, $subject, $message, $headers);
if($mail_sent){
$success = 'Mail send!';
}else{
$Error = 'Mail Error: ' . error_get_last()['message'] . ' on line: '. error_get_last()['line'] . ' on file: '. error_get_last()['file']. ' Error type: ' . error_get_last()['type'];
}
?>
以下是SendEmail功能:
<?php
ini_set('SMTP','smtp.zoho.com');
ini_set('smtp_port',465);
ini_set('sendmail_from', 'noreply@XYZ.net');
//send the email
function SendEmail($to, $subject, $message, $headers){
$mail_sent = mail($to, $subject, $message, $headers);
}
?>
电子邮件中的URL:为:ttps://www.example.net/!
如果我加上双“h”:hhttps://www.example.net/ 在电子邮件中将是正确的:
有什么问题吗
注意:该链接甚至不能处理图像和电子邮件中发送的所有链接。尝试使用双引号并转义邮件文本中的内容:
$message = "<a href=\"https://www.example.net/path/?Verify=". $IDVer ."\"> here</a>";
你是说zoho正在吃掉你的hpyes xD,他正在吃a href或src的第一份章程,我不知道为什么D:请尝试不使用内容传输编码:引用的可打印标题和/或UTF-8字符集。