Insert HTML into email in Apple Mail - html

Is there a way to insert pure html into an email via Apple’s desktop Mail app (ie. creating a newsletter, tables, etc.)?
I know you’re able to do this on Mac OS via Thunderbird, just wondering if there’s a reliable method or extension for Apple Mail specifically.

Having been seeking for solution for so long.
Both cmd + a then cmd + c or cmd + i in Safari may drop some style/script. Occasionally I found a nealy perfect solution by myself.
Create a new mail in apple "Mail.app", write anything then hit cmd + s.
Find your draft at the left panel of "Mail.app". Drag it onto your desktop.
Edit the draft file with any text editor you like. See some html source code at the bottom of the draft file? Replace them with the html code you want to send then save the file.
Open "File" - "Import Mailboxes" in "mail.app". Select "Apple Mail", import the
edited draft file.
You will see your mail at the left panel of "Mail.app". Drag it into a "Draft" mailbox.
Finally open the mail, fill in To, CC, Subject, etc, and send your pure HTML mail.

There is a "simple" way : open your html content in Safari, then press command + i
The html content of the page will be inserted in the body of a new mail message.

I was also looking for a solution and found this thread. Here is how I paste code into Apple Mail:
Copy your code into the code beautifier at http://hilite.me/. Then save the generated HTML to a file and open that in Safari and Press command + i as Creaforge said (thanks for the tip).

To expand on what TheycallmeXiaoli said :
Create a new mail in apple "Mail.app", write Bonjour then hit cmd + s.
Find your draft at the left panel of "Mail.app". Drag it onto your desktop.
Edit the draft file with any text editor you like (ex: TextEdit)
Search for the word Bonjour you wrote earlier - Replace ONLY this Bonjour with your ENTIRE html code
then save the file.
do not delete anything else ! don't replace the current HTML tag just the word Bonjour
In the Mail App Select File -> Import Mail Boxes
Select "Apple Mail" & import the edited file.
You will see your mail at the left panel of Mail App
most likely inside an "imported" folder
Drag the file into your "Draft" mailbox.
Finally open the mail, fill in To, CC, Subject, etc, and send your pure HTML mail.
: )
Thanks so much TheycallmeXiaoli !

Related

URL for opening a link in a calendar application

This is a html link/href/url when you want to open a link with an email client (like outlook)
Send Mail
What should be an html link when you want to open the link with a calendar client (like calendar from microsoft outlook or similar calendar application) in order for them to also save some information regarding appointments/events?
Is there a general approach to these urls to be able to open with them different applications?
Thank you
There's no common link to be used across different calendars (Google, Outlook, etc...) you can work with some of those, but my suggestion is to use free "link builders" like http://addtocalendar.com or https://www.addevent.com for example.
I resolved this by creating below registry entry
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\outlookwebcal]
#="URL:Outlook Add Internet Calendar"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\outlookwebcal\shell]
#="open"
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open]
[HKEY_CLASSES_ROOT\outlookwebcal\shell\open\command]
#="\"C:\\Program Files\\Microsoft Office\\root\\office16\\Outlook.exe\" /select outlook:calendar"
then markup should be like
<button id="outlookCalendarBtn" onclick="window.open('outlookwebcal:')">
Open Outlook Calendar
</button>

Email Blast - Adding an .ics ( Calendar Event ) to an anchor tag and having it open within Outlook

Link to JSfiddle
My first attempt at an HTML email blast and I'm kind of stuck on attaching an .ics and having it open within outlook or whatever their preferred email client is instead of downloading the .ics file directly.
The requirement
1. Clicking on the image adds an event to your calendar. (I prefer this not to be a hosted .ics file, but my searching has not led me to a way to hardcode the .ics within the HTML email)
Here's the offending HTML:
<a href="webcal://http://mathiasprovinggrounds.com/WinterWunderman/WundermanWinterParty.ics"><img class="image_fix" src="http://i.imgur.com/SvlJYLU.jpg" alt="Wunderman Winter Party!" title="We Survived the Holidays! Until next year..." width="x" height="x" /><a href="">
Currently when the email is sent and the user clicks on the image, the calendar is downloaded via their preferred web browser and not opened directly in outlook.
I've tried the following:
Hosting the .ical directly and using href="http://mathiasprovinggrounds.com/WinterWunderman/WundermanWinterParty.ics"
Using the webcal attribute as found here.
Is there a specific way I could hard code an .ics instead of hosting it on my server? That seems to be the ideal solution, but the only results I have found would include PHP and I would like to keep everything within a single HTML.
I believe the answer you were looking for could be found on this page under Creating a single-event link: https://msdn.microsoft.com/en-us/library/hh846807.aspx
Your URL, with the values replaced:
http://calendar.live.com/calendar/calendar.aspx?rru=addevent&dtstart=START_DATE_AND_TIME&dtend=END_DATE_AND_TIME&summary=EVENT_TITLE&location=LOCATION_TEXT
START_DATE_AND_TIME = yyyymmddThhmmss, required.
END_DATE_AND_TIME = yyyymmddThhmmss, required.
EVENT_TITLE = Escaped string, optional.
LOCATION_TEXT = Escaped string, optional.

google app script sending mail as PDF issue

A script was working fine 6 months ago and now is creating me some issue when sending a doc as pdf...-> My pdf loose his layout.
I am not loosing the doc's layout when i send the mail manually using (from the menu) file ->Email as attachment -> choose pdf
but when i use this (a script.) i've got 25 extra pages and i loose the oirginal layout of the document.
var fileq = DriveApp.getFileById('17Fj7JfYkQk9blablabla');
MailApp.sendEmail('somemail', "Attachment example", "blablabla", { name: 'Automatic Emailer Script', attachments: [fileq.getAs(MimeType.PDF)] });
What is going on ?
thanks for help,
another problem:
The problem occurs even when downloading more than 1 doc in pdf at time...very wierd..
The only thinhs who works in extract 1 file to pdf at time manually...all other stuff (scripting or manually) just modifiy the layout.
May be this problem is related only for big file..my docs are 20 to 25 pages long.
Who knows ?
Thanks for help anyway
The problem did not ocurr with me. You can see the sample here.
Please change the document ID in this script and run again sending to my mail and I will check the results.
It adding to me 24 extra page..changing the layout of the entire original document.

Customise email before sending

I am recoding a friend's artist/client booking system. I have little experience in programming, enough understanding to hack my way through and google has been a great help!
I've spent the last 3 days reading and searching... Havn't found anything on that... Maybe I'not using the proper terms....
Here's what I want to do.
I use Google Script and google spreadsheet. 1 row contains all the information about a specific contract.
I want to be able to use a menu item to generate the contract (completed)
Open 2 browser window
one to display the Contract PDF file ( completed )
one for a GMAIL New email
with the contract pdf attached ( completed )
generated email body from selected row in the spreadsheet( completed )
be able to customize the generated email text before
sending it. Adding attachements...
This is what I'm stucked at. I use
MailApp.sendEmail('xxx#yyy.com', 'transfer email as pdf : body
& attachment', 'see attachment', {attachments:[body_to_send]});
It send's the email ok, with attachement and generated body and all... but no way to edit the email before sending...
Is that possible with google script?
Explore the UiApp class in Google Apps Script. UiApp
You could build a simple UI where the user can enter additional content and upload files, which can then be appended to the email before sending.
It doesn't look like Apps Script supports creating email drafts, which would also provide a way for you to edit emails before sending them. (Sending an email to yourself with a fancy way to reference the ultimate recipient is another possibility using the native Gmail UI.)
Is this in the direction you were thinking?
The last step of your process can be achieved using a Google Doc template in which you can add whatever you want to improve presentation.
From there you get an html version of your doc and use it as a html body in your mail.
If you need more details about html import you'll find it easily on this forum and on the issue tracker.
You could also run this code from a document bound script in a sidebar which would be visually more convenient. (see my recent posts about mailmerge).

How can I embed a link button in mail to be sent to Notes clients?

I have to send an email to several hundred users. Each will have a link tailored to the recipient so I need to generate the emails in script/code - I'm no Notes developer so I can't do this in Notes; I'm using C# and I'm pulling the list out of a SQL database.
There are some constraints:
The site that the link points to uses Integrated Windows Authentication.
The sender wants the link to be a button, rather than text.
The vast majority of recipients are running Lotus Notes 7.
I've tried creating an HTML mail but have had problems:
If I use a form with a submit button and action that points to the link, Notes tries to use its internal browser which fails (because the site uses Integrated Windows Authentication).
If I use an a href tag with an img tag in it, pointing to an image on a webserver, Notes refuses to display the image - i just get the red x box, even though the tags are valid if embedded in a web page.
Anyone know how I can do this?
I finally found a method that works: embedding the image in the email itself. I found the solution here. I'll include the critical stuff here, just in case.
There are three key components to the email: the plain text version, the html version and the image, all consructed as AlternateViews:
string imagePath = #"C:\Work\images\clickhere.jpg";
AlternateView imageView = new AlternateView(imagePath, MediaTypeNames.Image.Jpeg);
imageView.ContentId = "uniqueId";
imageView.TransferEncoding = TransferEncoding.Base64;
:
//loop to generate the url and send the emails containing
AlternateView plainTextView = AlternateView.CreateAlternateViewFromString(
BuildPlainTextMessage(url), null, "text/plain");
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(
BuildHtmlMessage(url), null, "text/html");
//set up MailAddress objects called to and from
:
MailMessage mail = new MailMessage(from, to);
mail.Subject = "ACTION REQUIRED: Do this by then or else";
mail.AlternateViews.Add(plainTextView);
mail.AlternateViews.Add(htmlView);
mail.AlternateViews.Add(imageView);
//send mail using SmtpClient as normal
:
//endloop
BuildHtmlMessage(string) and BuildPlainTextMessage(string) just return strings containing the messages. BuildHtmlMessage includes this to display the image in a link to 'url':
sb.AppendLine("<div>");
sb.AppendFormat("<a href=\"{0}\" target=\"_blank\">", url);
sb.Append("<img alt=\"Click here button image\" hspace=0 src=\"cid:uniqueId\" ");
sb.Append("align=baseline border=0 >");
sb.Append("</a>");
sb.AppendLine("</div>");
Hope this is of use to someone else, sometime.
I imagine no matter what link you use (button, text), you're going to run into that same problem where the Notes client launches its internal browser. That's a preference on the Notes client, and it could be different on all machines.
I would first try a standard text link to see if it has the same behavior. Maybe if that does work for some reason, you at least can deliver a workaround.
Regarding the image issue - is the image coming from the server using Windows Authentication? Make sure the image is open to the public and doesn't require authentication to see it (test in Firefox, and if you don't get a password prompt, you're safe)
I hate to say it, but you might have to request users copy a URL from their email to a specific browser. At least you'd know that would work.
I agree with Ken on the preference for the internal browser. The image not displaying - showing a red x - might be a preference also. I don't recall if it was available in R7, but in R8 there is a preference to not show remote images automatically. It is a security feature. It could also be a proxy issue - if they would have to login to their internet proxy server to get to the internet, and your image is on the internet...
There is also this but it fires off a security warning to the user with my Notes config:
<input type='button'
onclick=document.location.href='http://server/path';
value='Click here'
id='buttonID' class='button'
xstyle='background-color:red;color:white;'/>