将网页发送给朋友电子邮件的脚本
我需要一个 php 脚本,您可以使用它来设置在线新闻通讯,然后提供一个链接,允许访问者将网页作为新闻通讯通过电子邮件发送到其他人的电子邮件...
这可能吗?我想是的,就像这里所做的那样。这正是我所需要的。我想设置一个新闻通讯,添加一个脚本,允许访问者将该新闻通讯直接发送到朋友的收件箱。 http://www.pretoria.co.za/interactive/forward-newsletter.html
我想我只需要脚本将 html 文件发送到电子邮件地址
请帮忙 - 谢谢
I need a php script that you can use to set up a online newsletter and then have a link that will allow the visitors to email the Web Page as a Newsletter to someone elses email...
Is this possible? I suppose it is, as it is done here. That is exactly what I need. I want to set up a newsletter, add a script that will allow the visitor to send that newsletter directly to a friends inbox. http://www.pretoria.co.za/interactive/forward-newsletter.html
I suppose I just need the script to send an html file to the email address
Please help - thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用MySQL和邮件功能,或者使用例如这个。
Use a MySQL and mail function, or use e.g. this.
使用电子邮件包装脚本之一(例如 phpMailer)可以相当轻松地编写此内容。但是,这样做时,请特别注意可能导致垃圾邮件和其他形式滥用的问题。您应该花时间真正锁定客户端以及所有输入变量的服务器端验证。
话虽这么说,最好的方法是将页面的 HTML 保存在数据库中,并将其提取到电子邮件正文中。您还应该包含纯文本版本作为备用正文,以便没有 HTML 电子邮件的人能够阅读它。然后,当有人提交表单时,只需验证数据,将消息与您选择的邮件程序类可用的方法放在一起,发送电子邮件,然后重定向到“谢谢”页面。
That can be written fairly easily using one of the email wrapper scripts, such as phpMailer. However, when doing so, pay particular attention to issues that could lead to spam and other abuse of the form. You should spend the time to really lock down the client-side, as well as server-side validation on all input variables.
That being said, the best way is to save the HTML of the page in a database, and pull it out into the body of the email. You should also include a text-only version as an alternate body so people without HTML email will be able to read it. Then, when someone submits the form, just validate the data, put together the message with the methods available with the mailer class you choose, send the email, and then redirect to a "thank you" page.