Forward This E-Mail PHP Script? - php

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..

Related

How effectively send messages to a group of email addresses using a central address?

I have to set up an email sending solution, and I haven't yet figured out the best way to do this, I hope you have some ideas. I would like to achieve the following:
Have a central email address like mailinglist#mysite.com.
Behind this list there is a database of email addresses. I would like to be able to extend this list through an API. For example if a new user registers on my site, I want to add them to the list. Or if someone unsubscribes, I want to remove him from the list.
On my website I will place a button, and if the user clicks it their email client opens with the central address prepopulated.
If they send an email to this address, everyone will recieve it who is on the list.
If someone replies also everybody will recieve it.
(The application is written in PHP (Laravel framework) if that is important).
Do you know of any service where I can set up this kind of "mailing list", preferrably for free? (It would have a few hundred members, sending a somewhere around 30-100 emails a month.)
I guess you'll need root access to your (linux) webserver - then you can hook Sympa (read "list of features") into your MailTransportAgent (MTA) (postfix, exim) or whatever.

What is an Auto-Responder?

I'm a noob and seriously confused. I built a form for my website with a php script that validates and sends an email to me when someone fills it out. So, what is an auto-responder? Do I incorporate that some how with my php script, or do I not need the php script at all if I use an auto-responder? Thanks in advance
Autoresponder is automatic mail shooted back to the origin email box , it may contains information like "Thank you for email and will get back to you soon". It can be configured at the mail provider or you can also do the coding for the same. As any user submit the form and he has valid mail , just read his email id in the last and send him the thanks email immediately . Later you can see his feedback and reply again.
An autoresponder is used for automatically sending email notifications when something happens, like you just subscribed to something. Some web hosting companies such as GoDaddy offer autoresponder email features under cPanel. I'm pretty sure big names have them. Just configure it under cPanel. Another way to do this is having a local program check the database for new members and using the program to send email to the new members. I did the second option for educational purposes but the first one should be more efficient.

Email relaying with php | craigslist's anonymous email generator

I wanted to create (or at least learn/know how it is done) application(or configuration?) that does similar to what craigslist does when people choose to hide their email with the "anonymous" option when making posts. I suspect that it is done with what's called email relaying. I'd like to find out how it is done in process - from when user enter their email to receiving an email via an anonymous email address. I come from a "LAMP" background at an intermediate level so please bear with me and kindly explain.
Your responses/comments/suggestions/pointers are greatly appreciated.
Thank you
The easiest way to do this is to receive email with your php app. There are a wide range of ways to do this, collecting using cron, piping from an email server directly into your app or using a third party like CloudMailin.
I wrote a blog post explaining some of the methods you can use to receive incoming email using php here. The post discusses rails but the principals are the same for most languages and frameworks.

mailto: replacement due to size

I have a web page that generates several email addresses. I need to be able to click on a link, which will open an email client such as outlook and populate the bcc field with those email addresses. In the past, we have used html's mailto, which achieves this goal perfectly.
My problem now is that I need to send emails to over 200 people, and mailto cannot handle that much information. Since the page also uses PHP, I have considered PHP's mail() and phpmailer(), but since both require that the entire email be generated on the page and the email client is never opened, they will not work.
Does anybody know of an alternative method I can implement to achieve this functionality?
Create a mailing list, add those e-mails to the mailing-list and send mail there instead.
As a bonus, you can use VERP to prune invalid addresses.
I don't think there is a convenient alternative method.
You could offer a textarea field containing all the addresses in a comma-separated list. That list could be easily copy+pasted into the client's E-Mail program.
If the client's E-Mail is on the same domain as the web site, and you have full control over your server, you could randomly generate E-Mail addresses on your server using PHP:
1293820239453202349#example.com
that E-Mail address would be configured to forward incoming mail (that your user with the mail client writes and sends to that one random address) to the big list of recipients. This is a very advanced method but hard to implement.
Maybe you can make an email group, depending on your mail system, such that when you send a mail to the address of the group, it will distribute to all members?
On our company, we have several groups. all#company.com, sales#company.com, developers#company.com etc. Sending one e-mail to such an address will make all members of the respective group receiving it.
MailTo with a Copy
<a href="mailto:astark1#unl.edu?cc=ASTARK1#UNL.EDU">
MailTo with a Blind Copy
<a href="mailto:astark1#unl.edu?bcc=ASTARK1#UNL.EDU">

How can I create an email newsletter by taking objects from a database?

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.

Categories