在电子邮件正文中添加“立即回复”按钮

时间:2018-11-26 12:02:20

标签: php email html-email

我想在电子邮件正文中添加CTA按钮“立即回复”。我们怎样才能做到这一点?它的行为应类似于Gmail的“答复”按钮或任何其他电子邮件答复按钮。

例如:

.....
If you want to know more ...
 [REPLY NOW]

Regards,
******

1 个答案:

答案 0 :(得分:0)

这将以html格式发送一封电子邮件,其中包含一些示例文本和一个略有样式的按钮。调整内容并添加到您的需要和喜好中...

 $mailTo       = "mail@receiverdomain.com";
 $mailSubject  = "Testmail with a styled button.";
 $mailHeaders  = "From: no-reply@yourdomain.com\r\n";
 $mailHeaders .= "Reply-To: no-reply@yourdomain.com\r\'n";
 $mailHeaders .= "MIME-Version: 1.0\r\n";
 $mailHeaders .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
 $mailContent  = '<!DOCTYPE html><html><head><style>button {background-color: lightblue;}</style></head><body>';
 $mailContent .= '<h1>Hi! This is sample content</h1><p>This is a sample paragraph.</p><a href="http://www.stackoverflow.com/"><button>Go to Stackoverflow!</button></a>';
 $mailContent .= '</body></html>';

 mail($mailTo, $mailSubject, $mailContent, $mailHeaders);