Write an html code to attach a file in mail - html

I am trying to write an HTML Code which on clicking on one of the links a mail is sent to respective mail Id.But along with that mail i also want to attach an attachment by default.Uptill now i am able to pouplate rest of the fields like to,cc,bcc,sub but the only thing remained is attachment.
Can anyone sort it out for me.Your help would be appreciated and thanks in advance.

I may be misunderstanding the question, but you're not going to be able to add an attachment to an email with HTML only. You're going to need some server side code.
Are you trying to use mailto: to do this?

Attachments are encoded in mail messages according to the MIME standard. All the major web scripting languages have modules to read and write MIME messages. Searching for "MIME" at CPAN for instance will turn up lots of useful Perl code.

Related

How to send an email with a form inside

Is it possible to send an email with a form inside ?
We want to send an email to our subscribers with an input text inside the email to get a complementary information, I havn't seen this before, is it possible to do that ?
If yes, which problems could we meet with that solution ?
I do not think that this is possible...
and even if it is, I wouldn't choose to do it.
You can not know what device your user will be on and if his mail client will support this.
If I were you, I'd just link them to the online form they have to fill. (You could use Google Docs for instance) or do it on your own website with an html form and write it to a database.
Why go through the pain of having to deal with hundrets of emails?

How do I stop Gmail from stripping the values out of URLs?

I recently learned that webmail clients like Gmail will do alterations on HTML emails, for example adding target="_blank" to <a> tags.
I've also discovered that other alterations happen as well. When I send an HTML email to Gmail (and possibly other web mail clients) from my PHP script, variable values included in the URL of any links are being stripped out. So, for example, this is the value I'm setting in my PHP code:
$mailContent = '<p><a target="_blank" href="https://example.com/confirmation.html?verification=x1x1x1x1x1x1x1x&email=yyyy#email.com">click here to go to the web site and activate your account!</a></p>';
But when the email is received in Gmail, the HTML code comes out like this:
<p><a target="_blank" href="https://example.com/confirmation.html?verification=&email=">click here to go to the web site and activate your account!</a></p>
The values x1x1x1x1x1x1x1x and yyyy#email.com have been stripped out from within the <a> tag.
How do I protect the values of the variables that I want to pass to the URL so that Gmail won't remove them?
Click View original/source on the message in Gmail to see if the URLs looks like they should then. If so you know that the problem is how Gmail is formatting the message for your viewing. If it's mutilated even in the source I was wondering if there's anything in your webpage/php/CMS (do you use one) that changes the code.
You should try URL-encoding as #Crisp said. Here's the W3 reference.
Emailing in html uses Quoted-printable Encoding. The problem with your $mailContent is that the "=" must be represented by =3D
Try adding this:
$mailContent = quoted_printable_encode($mailContent);
This may not be the perfect answer, but if your application allows for it, I have used URL shorteners a number of times.
http://goo.gl/ is my preferred because the API is super easy to implement and google is very fast. I have a function in a class and I just run my url through it and send the return wherever I need it to be.
Another non-perfect answer here but, my problem was that I was including an http url in the html body and apparently is not valid so I changed them to https. This was on a dev environment so no problem on production.
Here is more info about this:
Any URL's in the body of the mail which lead to insecure sites may also need to be removed. Use https://transparencyreport.google.com/safe-browsing/search to validate these links.. All links should be correctly prefixed with "https". https://en.wikipedia.org/wiki/HTTPS Google seem to be rejecting "http". Sometimes, but not always, removing links from any signature can help.

Sending HTML emails out from Plone

Are there examples of sending simple HTML formatted emails (<h1>, <b> and such) out from Plone?
Plain text is well-covered, but there are no HTML email out examples.
You can adapt any of the many python email module examples. Because HTML email usually means sending multipart/alternative messages, things get a little more complicated.
The examples page of the email package.
Sending HTML email using Python
Sending Multipart html emails which contain embedded images
You basically have to construct an email.Message object and pass that to Mailhost.send.
Depending on your use case, you could also use collective.watcherlist.
This was factored out of Products.Poi, which uses it to allow users to subscribe to updates for an issue. That part may not be interesting for you, but it has code that takes a browserview as basis for sending an email. Hooking a page template up to that browserview is of course simple.
If you cannot use it directly, it may serve as a code example.

URLENCODE Variable in Salesforce Vertical Response Email

This is a rather simple question, but I cannot find documentation about it from Salesforce.
I am setting up an HTML Newsletter from Salesforce Vertical Response, and I need to put a link in the body of the email that goes to another site which takes the user's email address as a query string. I am doing this so that when the user clicks the link from the HTML email, they will automatically be signed up for a different blog mailing list.
The link will look like this www.mywebsite.com/blog/subscribe?email=your_email#email.com.
I can easily accomplish this by using the {EMAIL_ADDRESS} variable, such that the link looks like this:
Subsribe
This workds, but when the user gets the email and clicks the link, the '#' symbol gets stripped from the URL. Now I'm trying to figure out how to get around this. I saw some documentation on the URLENCODE() function for SalesForce, but when I try to use it in the HTML email editor in SalesForce, like URLENCODE({EMAIL_ADDRESS})it doesn't execute it, and instead interprets it literally as text. Can anyone help me? is it even possible to use functions from within the SalesForce HTML email editor?
Thanks
I havent used VerticalResponse, but if it leans on salesforce communication templates then you can always create an email template as Visualforce page. Then you can apply Encode functions to merge fields.
I'm glad you were able to find a workaround. If you ever go back to dealing with the URL, it's a good idea to disable our click-tracking when working with merge fields. This can be accomplished by adding nr_ before the http. Example: Subsribe - If you ever try that and it doesn't work, or if you have any other questions, please let us know via one of our Support channels:
support#verticalresponse.com
866-683-7842 x1
We also have live chat available: http://help.verticalresponse.com/
Regards,
Keith Gluck
VerticalResponse Customer Support

Web Based Email Renderer

My company has a requirement to render MIME encoded emails (HTML) in a browser window. This isn't part of an MUA, but a tool we need to add to our product. I've looked all over the net for a product/library and I'm not finding one.
Has anyone used anything to render emails in a browser window?
You didn't mention a language, so I'll assume you're flexible.
Python would be my preferred solution - it has email parser, and pyzmail. The latter is a bit easier to use, the former is more compatible.
PHP has MailParse and Mime Mail Parser.
Ruby has Mail.
Just extract the HTML using the relevant function in whatever library you go with, then either render it straight to the browser, or save it on the filesystem and return a link. You can't 'link' to attachments from the email body, but you can get the attachments from the parser library, save them and generate links to the files.