I have a form, which gathers some Information of my visitor, and when they submit the Information, it will send it to my desired email. now I need another input "file" that they can even attach their photo and send along with it to my email not on my server, I have no Idea how can I do that, I would appreciate any helps.
phpmailer is a great email engine. it has many features one of which includes sending attachments. i would give this example a look, its pretty much exactly what you are trying to do.
http://zainal.wordpress.com/2007/01/10/sending-email-attachments-in-php-using-phpmailer-class/
Check out PEAR Mail_Mime for building the e-mail with attachments and optionally PEAR Mail for sending it.
Here's a link to show you how to do the file input:
http://www.cs.tut.fi/~jkorpela/forms/file.html
When you send the email, you'll have to send the file as an attachment. This link gives the idea:
http://www.webcheatsheet.com/PHP/send_email_text_html_attachment.php#attachment
(DISCLAIMER: I haven't coded PHP for a few years, so I don't know if this is the best way to do it. I just searched Google and skimmed the first link that came up).
Related
I want to add an image in the mail headers just like Youtube has when I receive an email from them. I'm simply using the php mail function to send emails, but I can't figure out how to implement this. Am I thinking it wrong?
Here is the final result I want
Thanks for your time,
Felix
You can pass HTML as body in your email.
The only problem is that outlook does not support it.
But all you have to do is build your email body in html and send it using PHP.
For the header it looks more like an tag or something, maybe it's not send via PHP. you could check out software like mailchimp.
P.S. make sure your image is hosting somewhere because you can't access it localy.
I want to find out if there is a way to read email information from a certain address with php, and take the From,To,Subject,Date and store them into a MySQL database. I would like to either check for new mails on a button click for example, or ideally when an email is received to get somehow the new mail and store the info i want.
I hope i have explained my question well..
it depends if the site is yours.
if you are the owner of it or the coder it is possible to save it while sending simply by collection the info and saving it and only then send the email.
but if the email service itself is not yours (for example Gmail, Yahoo etc..)
you cannot save the data with php. creating a program that reads emails could be possible, but i myself havent gone far enough to make a program that reads sites.
I have an html emailer sent out via a program like Mailchimp. The emailer has an embedded contact form using PHP. The form works fine when filled in from a browser, but returns a blank email when filled in from the email client.
Any ideas?
Thanks
Jane
No. I'd steer well clear of this. Campaign Monitor has a very good article on this. It goes further than just saying no. Well worth a read but here's the bottom line:
The Recommendation: Given the sporadic support for forms in emails, we
recommend linking to a form on a website in an email rather than
embedding it therein. This is the safest, most reliable solution to
pairing an email message with a form. More people will see it and be
able to use it, and as a result participation will increase.
http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/
Does anyone know where and or how I can build a PHP Script for a Newsletter that would allow the end-user to Forward their received E-Mail to a friend or so?
Basically, allowing them to take the entire body and subject of the e-mail and open up a new E-Mail Draft which would allow them to enter in the contacts they want to forward the e-mail to?
I am fully aware that this function is available in most, if not all, e-mail clients to this day. But it is requested that this functionality be added within the newsletter.
Any guidance? Any concepts? Any feedback would be greatly appreciated.
Thank you!
If I understand you correctly, you'd need to do the following:
in your email create a "Forward to friend" link that directs the user to a php page on a remote server.
On the remote page, create a script that would contain a form asking for the email address of the friends to email.
Use the mail() function (Or 3rd party class) to mail the users
EDIT:
You can take it another step further by using one of Google's API's to automatically grab email addresses from the users account (Like LinkedIn etc.)
Have a look at ZF's Mail class, which allows to fetch emails using POP3 or IMAP and finally decompose emails into parts.
The ZF documentation page provides extensive sample code.
Add link to email which directs user to a web page that contains
<form action="sendmails.php">
<input name="sendto" type="text"/>
...
and send more letters from there..
Well, I'm trying to create a newsletter, that will send emails to users in a database. The newsletter itself would draw "events" and other activities from a database. Whats the best way to take that list, and put them in an email? I was thinking about putting them into an html page, then sending an html email, but not all emails support html(like school email). What would your guys recommend? Could you point me to some good resources?
Also, this is for a school project, so I cant use any open source type stuff, unfortunately :(
You are correct in your assumption that if you are creating html newsletters, you will also have to do a text based version for clients that don't support html or ones that ask to have e-mail be sent only in text. You will need to make sure your code sends both versions to recipients. You could also ask the recipients for their preference and send them the specific version that they requested.
For html e-mail it is highly recommended to read the following two articles by CampaignMonitor (they specialize in e-mail marketing sofware):
HTML E-mail Design Guidelines
Guide to CSS support in email
clients
Note that I am assuming you are asking for help with the actual construction of the html for the email not the code needed to create and send the newsletter.
Good luck with your project.
==== UPDATE ====
So it seems that you actually need help in developing this project. Since this is a homework, I will provide some general advice that should steer you in the correct direction and get you started on the project. Then, if you have any specific problems with your code, you can ask about them on Stackoverflow.
There is really two things that need to be done here:
In PHP, dynamically contruct a variable that contains the html or text versions of the e-mail that needs to be sent.
Loop through your contact list and e-mail the contents of that variable.
Sending E-mail
I will start with the sending e-mail portion, because the links provide bellow also show you how to construct the message. Also, in your comment you said you already know how to contruct an html from a database. The following links show you two ways to send e-mail. You can either use the Mail function that comes with PHP or download the PEAR_Mail package. If you are allowed to use additional libraries and want to send html e-mail, I would recommend using the PEAR_Mail, because it makes things much easier if you want to send a both an html and text version of an e-mail together.
Note: To send an e-mail you will need to use some sort of mail server. If you are using Windows, you can install the SMTP service that comes with IIS or you can use an external smtp service such as google to send your e-mails.
http://www.w3schools.com/php/php_ref_mail.asp
http://us2.php.net/manual/en/function.mail.php
http://www.webcheatsheet.com/php/send_email_text_html_attachment.php
http://pear.php.net/manual/en/package.mail.mail.php
http://pear.php.net/package/Mail_Mime/docs
Construct E-mail
The complexity here will depend on whether you just want a plain text e-mail or html. For either case you will need to read the event data from your database and add it to the message that you want to send.
Some Seudocode:
Loop through datarows
message = DataRow[EventDate] + " " + DataRow[EventName] + "\n"
Loop through recipients
mail message
Hopefully this gives you a start. I would recommend getting php to send out an e-mail of a static html or text first. Once you have that code working you can start working on adding the functionality of reading event info from a database and sending it out.
Hope this helps.