Sending Complex HTML emails with MAIL

Hi,
Does anyone have a script to send complex html emails with Mail?

I have a script that works with Outlook. Could someone guide me in how to change it to work with MAIL. (I don't know anything about writing scripts.)

Martha

Posted on Nov 6, 2004 12:40 PM

Reply
48 replies

Mar 30, 2005 2:22 PM in response to Andreas Amann

After playing with your script (it took a couple hours) i figured out that I needed to have the curson in the message area of the new e-mail before it would work. But now I have figured it out, I love it!!

My only question is: Apple's e-mail always has a test to see if the Mail app being used can read HTML mail, if not, plain text is displayed to the affect:

You appear to be using an email application that won't properly
display the graphical (or HTML) version of our newsletter. Because
we want you to enjoy reading QuickTime News, we recommend that you
visit the following site and switch to the plain text version of
this newsletter:
http://www.apple.com/enews/change/


Can this be done in conjunction with your script, or how would I accomplish this?

Thanks.

Mar 30, 2005 9:46 PM in response to Gary Sumlak

Andreas, I was able to modify the script just fine to import a text file with text/plain content, and add it to the html.

Can you tell me what the set keyword value is to add the text/plain text to?

i.e.
--This is_the_boundary_hipho
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Using "set plain content" keyword does not work, and there is not mention of the "html content" keyword for me to get a reference from.

Any help on this would be greatly appreciated.

Thanks
Gary Sumlak

[ Edited by Apple Discussions Moderator ]

Mar 31, 2005 3:38 PM in response to Gary Sumlak

Gary,

sorry for the late answer but I didn't see your question - this thread is starting to get a little long...

Unfortunately, you cannot add a plain text alternative to HTML emails generated in this way. Using the (undocumented) set html content will create a "text/html" message, a message with alternatives (like a plain text version) would be "multipart/alternative". To my knowledge, this is not possible to generate with AppleScript - simply setting the plain text content (which, BTW is set content) will be ignored when you set the html content, you also cannot manually set the content type of a message with AppleScript (which would be required for a multipart/alternative message so that you would know what the message boundary to distinguish between the individual parts is...)

To my knowlegde, a proper way of creating HTML messages with plain text alternatives in Mail would be to write a Mail plug-in (bundle) which would create the plain text version and change the headers when the message is being sent. Or, we just wait and see what changes Mail in 10.4 will bring...

i Andreas

Apr 3, 2005 9:01 AM in response to Andreas Amann

Thanks again for the reply Andreas.

Don't you just love undocumented features?! I'm glad to see that I am not going blind.

Although I found that your script works great for sending HTML emails for the majority of target clients, I found there are a couple that don't like the formating: i,e. Hotmail in particular displays the HTML content as raw source. Which is way irritating (typical MS issues), and hence the need for Alternative Text.

I did find a commercial bulk mailer for OS X, called MaxBulk Mailer from MAX Programming, that allows for the alternative plain text section, and it formats the html section in a fashion that Hotmail likes. The main feature I love about Max Bulk Mail is the management of large distribution lists: it breaks up the list into chunks (say 90 people) and spreads out sending those chunks over time (i.e. at 5 hr intervals, send the next chunk). Since, as I found out, Most ISPs have limits on how may people you can send a single mail to (my ISP is 99) and a maximum of 1000 emails a day (to prevent spamming), these features were perfect for a massive family newsletter I had to send out this week.

Although, MaxBulk Mailer is commercial ($49US), it does not expire, but adds a tag to the end of the emails stating that the email was sent with an unregistered MaxBulk Mailer. Hey, I can live with that for large mailings I do, maybe once a year! The one thing I don't like is it is really flakey for importing email list. You can drag and drop from address book, and names and e-mails format perfectly. But if you try to bring in lists from any other source, including text files, you have to spend a day making sure the headers and the format is just right. It would be nice if there was a way to remap fields on the fly, which nobody seems to to do, including Entourage X, that I have found anyway. Such an obvious feature to be universally ignored IMO.

Anyway, enough griping...

Thanks again for the info. That and going through the script, gave me a good understanding of how HTML email works. Without it, I would never have know what to look for in a mailer.

Here's hoping the Mail 10.4 addresses a need for HTML e-mail, and maybe has these very useful features properly documented.

Gary

Jun 4, 2005 7:29 PM in response to Gary Sumlak

Looking through the posts on this thread and I gotta chime in to Gary Sumlak's comments about MaxBulk Mailer -

If you think it's that's great and saves you time- pay the 49 bucks and support small software developers. It's not a "free" program even if it doesn'r expire. The licensing clearly states:

"MaxBulk Mailer is distributed as shareware; it is NOT free. If you use it for more than a week or two, please pay your registration fee. See How to Register for further instructions."

Do you work for free?

Jun 4, 2005 9:28 PM in response to Bob Jones7

Feel free to "Chime" away. Been a while since my post so I had to review what I said.

I have no problem paying/supporting Shareware programs and developers - probably half the software I use regularly is Paid for Shareware/Trialware. If I like it and it meets my needs, then I pay. BulkMailer does not quite meet that criteria.

I did not say MaxBulk Mailer was "great", (i said the Apple script works "great, however") but that I have several issues with the utility, and that I could "live with" the shortcommings. When those issues are dealt with, if I have not found another app by that time, you can be sure I will fully support the developer.

I mentioned the utility here, as a promotion to others that may find the apple script lacking (or have had problems with recipient's mail readers) and were looking for an alternative.

It is not, and never will be, my intent to advocate the exploitation of developers, If that was the impression I left with my post, I apologize to the developer and anyone who read my post.

Gary.

Jun 24, 2005 9:06 PM in response to Martha

For those who are not so skilled (such as myself) in the ways of AppleScript, there's another alternative (probably so obvious, that ya'll have been there, done that and outgrown the t-shirt) . . . .

I copy and paste my images (contained neatly in tables created in GoLive) into a new message, and close it. Mail keeps a draft of this and I do this several times (command-N, command-V, command-W) and create several HTML-like e-mails, ready to go at a moment's notice! I've sent sample e-mails to myself (on a different computer, different mail account) to verify. The only thing I keep forgetting to check is whether the links to my site and e-mails work . . .

BTW, I do plan on learning all I can about Mac OS X ~ I started out with a Mac about 11 years ago, but then went to PC's about 5 years ago (not my wish ~ compromise with the Hubby). I am now finally back to Mac!! And I will never go back to PCs!! But for now, whilst I deal with the learning curve in using the new OS, this method of HTML will suffice ~ atleast until I get tired of it and swap over to Tiger! ( :

Cheers!!
Connie

Jun 25, 2005 8:53 PM in response to Martha

Hello all!

Another method that also works great I found somewhere here @ these discussions forum that I copied but can't find again to give the person the credit he deserves is as follows:

As in the above mentioned technique, you can email html or attach a photo or animation from a web page on your server (or anyone else's for that matter) as a sig or body.
1. Create a html document in any html editor.
2. Upload it and all its associated files to a server.
3. Open Safari and go to the web page you created.
4. Select "Mail contents of this page" in Safari's file menu.
5. Mail opens up a new mail window with the contents inside.
6. To add the image or whatever to your signature, highlight it and copy it.
7. Open preferences>Signatures and paste it in your sig.
That should work. Worked for me.


The exact wording is not correct for me but the process worked great.

Jul 1, 2005 8:55 PM in response to Skip McKinstry1

For anyone having problems with this script like Skip and MagicGenie are/were, I too had the same problem and it boils down to this line not always working (at least for me on 10.3.9):

set theSourceMsg to outgoing message 1

Try changing the first few lines to the following (I'm no Applescript coder but this works for me):

----------------
tell application "Mail"
set whichMsg to 1
try
set theSourceMsg to outgoing message whichMsg
repeat until ((visible of theSourceMsg is true) or whichMsg > 5)
set whichMsg to (whichMsg + 1)
set theSourceMsg to outgoing message whichMsg
end repeat
set keepGoing to true
on error
-------------

Sep 13, 2005 8:17 AM in response to Martha

Hi,

Has anyone had any problems running Andreas Amann's 'Send Complex HTML' script in Tiger (10.4.2) ?

I've tried running it in Panther and it works perfectly but fails it Tiger.
Is it possible that the (undocumented) 'set html content' isn't working in the new version of mail?

I'm fairly new to Applescript, so I may be grabbing at straws.

Really hope someone can help? or maybe suggest another way of sending HTML with mail.

Kind regards,
Gary

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Sending Complex HTML emails with MAIL

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.