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
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.
Related
So a component in an app I'm currently developing sends a confirmation email to whoever the user puts in as their "emergency contact" which simply states that the user has chosen them to be the contact.
What I also want to do, which is what I'm stuck on, is embed a URL in the email that the "emergency contact" would click to confirm that they are fine with being the contact.
Once clicked, the status "confirmed" in the database would have to change to "true", and from there the app can act differently based on an (if confirmed == true) kind of thing.
Everything is currently built in AS3, with PHP and SQL acting as the backend user database (URLLoader being the connection between AS3 & PHP).
If anyone needs me to be more clear, or give a better example of what I currently have just let me know.
The actual nuts and bolts depends on how you built your server code and how fraud-proof you need your system to be, but in the simplest form the link in your email would be something like:
Click here to confirm.
for the html version of your email. (How you format the email is going to be determined by what libraries you're using to send it, but you will be able to send a message with HTML and non-HTML text that the email client can choose between.)
When clicked this would send a message back to your server with the proper email that you could then mark as confirmed. If you're using a framework, you would probably have a controller named 'confirm', or if not, a file called confirm.php that handles the response.
Note this has no protection whatsoever from fraud; anyone could send that confirmation message. You could add another random field in the link that would be authenticated on the server to improve things a bit, if necessary. Beyond that we're getting into an entirely different discussion.
For anyone else wondering how to send a confirmation code, check & validate confirmation etc.. this is a really good link that I ended up referencing, which really helped!
http://pastebin.com/rc89rggc
Kudos to Irwan who wrote it.
I want to send a welcome email when a user registers in my app.
When a user registers he gets redirected to his profile page.
I tried sending email while user creation but the email() takes 7 seconds to send email, and the page waits till then and then redirects the user to profile after 7 sec.
This is not desired. I want to redirect user as soon he registers, and send an email along the process. It takes 7 sec don't know why. i tried it online on godaddy and hostgator account as well as on my localhost.
BTW: i am using PHPMailer to send email.
How can can i make a standalone process which on invoke calls my sendMail.php with email $_POST[] parameters {to, subject, body}.
i though ajax call will do the trick, but as soon as my page redirects from registration to profile, the email script stops.
I tried this code:
<script language="JavaScript">
$.post( "sendMail.php", { to: "$to", subject: "$subject", htmlBody: "$htmlBody", altBody: "$altBody" } );
location.href=profile.html
</script>
Please help, i searched a lot but they work on shell which i am not, and other solutions were unix/linux based. i want to make it work on xampp as well as godaddy linux shared hosting, with NO ssh access.
You could use Mail_Queue, which is a job queue specifically for sending emails, or utilise Zend_Queue [ZF1, ZF2] to write something customised to work with PHPMailer. You might even consider using Gearman.
You could try to put the javascript in your profile page so it runs once they hit the profile page and not on the form submit. Just need to check if the welcome email has been sent already in you sendMail.php script.
But using this script to send an email may not a very good idea as it could enable a malicious user to send an email with what ever content they wanted to whoever they wanted and if it was marked as spam then it would be your server that got blocked. It is a very common technique used by "spammers".
You would have to be very careful in how you handeled the email before it was sent so as not to breach your agreement with your hosting company.
Php is single threading language. This means that you can not start a job before previus one executed (and finished)...
You may change task order. I mean you may send the email, after welcome page completely rendered.
Try with this order;
1) register user
2) show welcome page,
3) send welcome email....
with this order, your new user will not wait for 7 seconds before see welcome page.
I am trying to figure out how I can email a form to someone and have them fill it out and submit it directly from the email to be entered into a MySql database via PHP. I have read that this is possible, but I have not seen any code on how to make this happen. I am now looking at MIME standards for emailing the form. I don't know if that is even the right way to go. Can anyone offer me a direction on this with some instruction?
http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/
Theoretically, creating a web form in an Email that submits to a web-based PHP handler script (which stores the responses in a database) is identical to creating a form on a web site.
However, as you can see at the URL above, not all Email clients support HTML forms. Many users may also be wary of submitting a form within an Email message, because there's no telling where its really going to take you.
You may have also noticed that it's very easy to click on a link ;) why not just put a link in the email that takes the user to a form on your website?
The method you are suggesting sounds very difficult to implement. I think the approach you want is to create an online web form for them to fill out, and have the data be stored in a MySQL database. Then you can just e-mail the link to the form to the people who should have it.
Parsing MIME formatted e-mail is a pain in the ass, and often doesn't work right. Avoid it if at all possible.
Don't.
HTML support in email clients is not as good as it is in web browsers. They are particularly poor for HTML form support.
Host the form on the WWW instead. Include a link to it in the email.
I'm building a newsletter with PHP (Zend) / HTML / CSS, however I've added a "share" button on the newsletter design, I'm wondering if it's possible to somehow integrate it so that whenever someone clicks in this button, the forward outlook functionality would occur.
Is this possible? can someone point me out to the right direction?
You could link to mailto:?subject=<subject>&body=<body>, but it means that the entire content of the subject and body should existing in an url-encoded fashion inside that link. This means that the e-mail will be twice the size. Also, when you embed pictures, those will not exist in the new e-mail, so you will need to link them from the web.
And then, it's still fake. You can't really forward from inside the e-mail, it's just a trick that may not work very well, depending on the client. Especially when the mail is opened in a webmail page. A click on the link will start the offline client, or maybe no client at all, if the user hasn't got one.
Long story short: You can't, you shouldn't.
Trust your user that they know how to find the forward button, or redirect them to a site where they can enter addresses to forward too.
No email client that i know of support this feature in any way. Not even a reply possible. Maybe what makes you think this could be possible is the mailto: anchor handler that only asks the system to start an email edition with the ?subject= and body= query parameter.
But it doesn't allow you to edit or pass in any data to the mail client.
If you are going to be creating an HTML formatted email, you could simply include a mailto: link with a subject and body like so:
<img src="share_button.gif" alt="Share this" />
This would open a new email message in the users client of choice to allow you to send the email along. You could go as far as to include the html of the existing email in the body parameter. Keep in mind that it would need to be escaped html in order to display properly.
A better solution, IMHO, would be to take the user to a page on your site to enter an email address into a form which could then automatically send a copy of the email from your system.
why not just have the server send the email?
http://php.net/manual/en/function.mail.php
just beware of email injection vulnerabilities
http://en.wikipedia.org/wiki/E-mail_injection
TFMail was a popular PERL CGI Form Mail script at one time. So far it has served our purposes. It is very easy to set up and configure.
Unfortunately, it only has basic functionality. It works well when you want users to fill in a form and have the result emailed to a specified email address.
Can someone recommend a script ( maybe a PHP script ) that I can use to replace TFMail?
Here's the functionality that I like in TFMail:
Set up an HTML form and point the action at the script
The result of the form gets sent via email
Specify the recipient of the email
Create a template for the email sent to the recipient
Create a emplate for the email sent to the
submitter
Create a template for the
log file
Allow file attachments
Redirect to a thank-you/confirmation page
There are tons. If you use a framework, it will have something, most likely. If not, there is HTML::MIME, Zend_Mail (can be used with or w/o Zend), and many more just a google search away. In the late 90's, it seemed that everyone starting out in something like Perl or PHP would write a mailer as a right-of-passage or something so there are a million of them out there.
http://htmlmimemail.tuxfamily.org/
http://www.electrictoolbox.com/sending-email-zend-mail/
etc...
(Creating our own frameworks is the new right-of-passage, I think.)