Script to Mail web page to a friends Email
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 N开发者_运维知识库ewsletter 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
Use a MySQL and mail function, or use e.g. this.
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.
精彩评论