문제

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:

<a href="mailto:?subject=Sample Email&body=Body Text"><img src="share_button.gif" alt="Share this" /></a>

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top