I would like to send an html email with a link but want it to look ok if html is off in the recipients email client how can I do this:
With HTML:
Available Here
With Out HTML:
Available at https://stackoverflow.com/
Then use multipart alternative to send a text version alternative to your HTML email that has the full link.
You should ensure that your text is readable without css or html formatting (i.e. if you're using tables, make sure the order of the text is ok if you strip the tags, if you use images, use alts)
Use a library such as SwiftMailer that will let you add multipart content to an email. It's much easier than setting the headers yourself.
Related
We require the users to reply in a specific format about their problems. Our current application sends an auto-generated mail which has a mailto embedded like this
Contact Application Team
What we want now is to include a table in the embedded "mailto" so that user can describe their problems in much better way. We have tried encoding html inside mailto body, but it gets treated as simple text.
Is there any way to include the table in the mailto body or any better way to improve the interaction.
It is not possible to include HTML in the mailto body, as defined in Section 2 of RFC 2368.
Possible alternate solutions:
Have users type their information into an HTML form and then use PHP (or similar server side language) to send the email
Try to format your email a little bit nicer by adding in some line breaks. You can use %0D (Carriage Return) followed by %0A (Line Feed). Maybe something like this:
Contact Application Team
How to send a e-mail with html content and inline images using lotusscript agent?
GMail removes the inline images to file attachments.
IS it possible to prevent this?
Modification as requested in comments:
I have created a document to be used as mail template. This can be a normal memo in your mail file. In the body I added an image, like company logo, and some text. This memo is sent with lotusscript insted of manual sending button.
The lotusscript agent first remove the body and copy its content to a temporary rtitem. The text is replaced with merge field values. Then a new rich text item is created with the replaced text. The result of the text processing is a removed inline image in gmail.
Hope this information is enough, and this is the reason I think the code is not interesting here.
"MIME HTML inline"
look here http://www-10.lotus.com/ldd/nd6forum.nsf/0/c570f4a6e09a0d7585257333005217e9?OpenDocument
on gmail works.
all best
I tried using External Source but that just returns a broken link.
If you're just going to need the HTML source of a webpage, and not anything else, and you're willing to use a server-side language, there is the option of using curl, file_get_contents, or Simple HTML DOM to get the HTML of a website, and then display that on your own page between <code></code> or <pre></pre> tags. This would look something like this in PHP
include("simplehtmldom.php");
$html=file_get_html($url);
echo "<pre>$html</pre>;
Obviously this should be formatted or prettyprinted. Take a look at Google Code prettifier to do this. If you want to get the source of your own page, you could use Javascript, and do this:
var html=document.documentElement.outerHTML;
I'm not sure how that would work for fetching external pages, but you could try an iframe for that, like this
document.getElementById('frame').contentWindow.documentElement.outerHTML;
The schema/protocol http: is missing:
External Source`
Test with the scURIple (scriple):
data:text/html;charset=utf-8,<html>External Source</html>
As an alternative to outputting everything in a <pre> block, consider returning a different content type. In your response headers:
Content-Type: text/plain
Then, you can simply return the HTML content and it will be displayed as plain-text in the browser.
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.
So let's say that there is a HTML (or XHTML) code and
<img alt="...." src=".......aspx" />:
So, aspx generates image file, and there will be some image shown.
Now I want to send the generated image file to E-mail or using HTML form code, and I want my html code to do this automatically.
So, in the html code, after img code, I'd like to add codes that send the generated image automatically.
(I want a single code with img code and E-mail or HTML form code.)
What should I do?
To be honest, based on your question, it's not entirely clear what you're trying to accomplish. But, from what I gather, you could try several different approaches:
Check out this StackOverflow post: Sending an email with an image embedded in the body from C#
You can use the code from this source as a starting point: http://www.codedigest.com/Articles/ASPNET/95_Sending_Email_using_C__and_ASPNet_20.aspx (see "Sending Email with Embedded Image in the Message Body" section)
What you need to do is move the image generation logic to some library or the App_Code folder, and then call that logic twice: once from the .aspx handler that sends it for the tag, and once for the code that you also need to write that will send it in the email. Once you have the byte[] array with the image, follow lkaradashkov's link to send it in the email:
Sending an email with an image embedded in the body from C#