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
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.
This may seem like an easy question, but --
How do i make it so when a user clicks on a link on my site, it opens up an outlook (or whatever client they use) with the file (in the link) as an attachment?
I don't want to use php's mail() function since i want the user to be able to send it as an attachment him or herself.
Or is this whole thing impossible?
Thanks.
That's not possible. At most you can set the To: and Subject: lines via the link itself, but you can't force an attachment.
Click me!
Sorry, you can't do this. The best you could do is mailto link which unfortunately doesn't allow to set attachments.
You can create a form field for the user to enter his / her e-mail, then post to a php file which will grab that e-mail addr and send your attachment.
besides - mailto links are a pain in the A$$ for some users because they may be using a web based e-mail client as their primary, and a mailto will force something like outlook to open
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.
I am sending an html email with php and it includes an image. Some email programs, such as gMail have a 'display images' button. The user has to click on that in order for the images in the email to show up.
Is there any way I can force email programs to show images that are sent within html emails generated by php?
As a rule of thumb, email clients are configured to display attached images by default (e.g. those with a cid: URI scheme) and not load remote images (which can include tracking information).
If you attach all the images, then you'll usually get them showing up (while inflating your SMTP bandwidth use along with that of your recipients (which can make you unpopular)).
I'm afraid not. The main reason email programs block images is because images are often used to 'report back' to whoever sent the email that the email has been opened. This is a common tactic used by spammers. Also, malicious code is often attached to images and downloading these images is how such code gets executed. Another reason email programs block images.
No, you can't force programs you didn't write yourself to do anything.
Email is hugely variable, and in general you're going to see different results in different places. That being said: There's no general way to force an email client to display images; this is why most email now includes a link at the top indicating that if it doesn't display correctly the user should click on it (which then takes the user to a standard HTML page outside the email client's image/javascript/everything-else-blocking grasp).
You specifically mention gmail so it's worth pointing out that if you embed (CID URI) the images they won't show inline, they'll show as attachments at the bottom of the message.
Doubt it, it would be a security issue if the 'src' of an image opened up a cross site scripting attack.
Cross site request forgery
Customers of a bank in Mexico were attacked in early 2008 with an
image tag in email and were sent
through their home routers to the
wrong website.
You can, but unfortunatley Trident, which is the IE rendering engine doesn't support it (surprise, surprise), but it is technically possible to include images in the html itself - see http://en.wikipedia.org/wiki/Data_URI_scheme
The last place I worked, we were sending out emails that had images in them that would come up automatically, in outlook at least, without me having to explicitly click a show images button.
When I inquired, another developer explained that they simply copied the encoded block of the image from an already sent email into the body of the email. I think this may be a weird sort of workaround they stumbled upon. I don't know if this adds more weight than an attachment, but I could see how an email reader would see an attachment and then ask the user as opposed to read it already in the body and just show it...
i'm new in php. I want to send an email to someone and afterwards i need to check if this mail could be received. How do i do that? Hope you guys understand my problem ;).
Thanks in advance. Marc
That's a really sticky question. The only real way is to have PHP monitor an inbox to check for "undeliverable message" notices you might get back. If you're really wanting to go forward with it, look into POP3 connectors for PHP. Like this: http://pecl.php.net/package/POP3
if (strpos(strtolower($subject), 'undeliverable') !== false){
//do whatever you want with the address that couldn't be reached
}
You technically wouldn't need a compiled PHP extension for POP3 (especially if you're new to PHP)... you could connect and read messages by opening a socket and speaking mail server:
http://www.adamsinfo.com/a-rudimentary-php-pop3-example/
Edit (years later):
Definitely check out http://mailgun.net/, http://sendgrid.com/, and http://postmarkapp.com/.
If you're sending HTML mails, you could use a little trick:
generate a unique id for the mail you are sending (based on content and recipient)
include an image that is loaded from your webserver
<img src="http://yourdomain.com/tracker.php?id=1234567" />
in tracker.php, log the id that called the script and send a 1px by 1px image
This won't work though, if the mail client does not download images from the internet when showing an email, as Thunderbird does, for example (IIRC Outlook does so too)
There is no definite solution for this. Web bugs are a o.k. idea but they're dying out, as they are very problematic security wise and are blocked by default in every current E-mail client I know of. I would suggest a combination of checking a bounce inbox like brianreavis suggested, and in addition, requesting a delivery receipt using the following header line:
Disposition-Notification-To:<xxx.xxx#example.com>
That way, you can get most negatives (bounced mails) as well as many positives (receipts). Sending the receipt can be blocked by the sender, but together with parsing error notifications, you should have fairly reliable system.
One option is a Web Bug but these are far from 100% reliable, and are arguably not a nice way to behave. It won't differentiate between emails which are unread and those which are undelivered, for example because of a bad email address, and it is possible to read an email containing a Web Bug without triggering it.
In short you create an HTML email containing an element which has a URL on your site which is unique to that email. So if a client accesses that URL you can be sure that someone has read your email. Wikipedia gives this example:
For example, an e-mail sent to the address somebody#example.org can contain the embedded image of URL http://example.com/bug.gif?somebody#example.org. Whenever the user reads the e-mail, the image at this URL is requested. The part of the URL after the question mark is ignored by the server for the purpose of determining which file to send, but the complete URL is stored in the server's log file. As a result, the file bug.gif is sent and shown in the e-mail reader; at the same time, the server stores the fact that the particular e-mail sent to somebody#example.org has been read.
However, it is possible - probably quite likely - that someone can read your email without connecting to that URL. This may because:
A lot of email readers block such links by default because of privacy concerns precisely because of Web Bugs like this.
They read the email in text only, either because their email client is configured to do so or because it can't display HTML email, for example, a lot of mobile phone clients.
This is a often used option - both by spammers and more responsible marketers - but I probably wouldn't recommend it unless you fully understand its limitations and implications in terms of what people might think of you if you do use it.
There is a perfect solution, in terms of knowing the eMail has been read.
The bad part is that the body of the eMail must be stored on web server.
The trick:
-Send an eMail just just a small text and a URL, so the user must go to that URL to read de content of the eMail.
In other words... on the eMail there is nothing about what you want to send, there is only a link to a unique page you create before sending such eMail.
So to read the content the user must open a web browser and go to such URL.
The trick is to put a little of such text on eMail... something like: bla, bla, bla ... press here to read more.
The concept: Online body, offline URL to access such body.
That way you can be sure of this: if URL has been read, the eMail has been read.
The bad part is that the info you want to send is not on the eMail, must be on a unique webpage.
So you must control no robot can go to such URL... for example with URL like:
https://server/private/?eMail_Body=user
Hope this idea can help someone.