• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
HTML Mail.app
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HTML Mail.app


  • Subject: HTML Mail.app
  • From: wayne melrose <email@hidden>
  • Date: Fri, 26 Aug 2011 12:40:49 +0200

Hi, 


I'm already cowering at the idea of posting this, because I already know the answer.. I think.. 

Is it possible to send a HTML formatted email from Mail.app. 

I don't want plugins, I don't want another mail program.  and no I don't want GUI scripting  :-) 
Reason I say that is because this is not for me personally, this is for a workflow situation where I know the users have already been assigned Mail.app to use, and I want it to work natively for robustness (robustness .. can't believe that's a word..!?)
I don't want to rely on a plugin because again, this could mean setting it up on multiple machines, and I don't want the hassle and then also OS changes could break it. 
GUI scripting is another thing I'd just not want to have to configure, and I think this is a poor solution for making robust code. 

What I've found out.  
Safari
What I didnt know was this .. 

tell application "Safari"
email contents of (get current tab of window 1)
end tell

This is actually a great feature I think, and I could use this! If I could only add the recipient's name and change the subject via applescript after the mail has been created, however, it seems that's not possible.. (Someone is free to prove me wrong, remember, no GUI scripting) 


Ruby
I found a great Ruby script, and then investigated a little further, from what I understand I should be able to create a Ruby script to do this, again, I seem to have hit a wall, I know this is not a Ruby forum, but I know there's alot of grey matter out there on this list that know enough to solve this problem.. I think this is probably the best solution I've found, however, I can't get it to work!! 
Could someone point me in the right direction.. ? 


#!/usr/bin/env ruby -w
require 'net/smtp'

message = <<MESSAGE_END
From: wayne melrose <email@hidden>
To: someone else <email@hidden>
MIME-Version: 1.0
Content-type: text/html
Subject: SMTP e-mail test

This is an e-mail message to be sent in HTML format

<b>This is HTML message.</b>
<h1>This is headline.</h1>
MESSAGE_END

Net::SMTP.start('smtp.me.com', 25,'smtp.me.com',  'email@hidden', 'mypssword') do |smtp|
  smtp.send_message message, 'email@hidden', 
                             'email@hidden'
end



Triggering the script returns this error in terminal
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:60:in `open': execution expired (Timeout::Error)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/net/smtp.rb:463:in `start'
from /Users/waynemelrose/Desktop/test.rb:17



If anyone has a better/faster/easier solution, would love to hear about it, However I'd be more than happy to have a result to this Ruby script aswell. 

Thanks
Wayne Melrose
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: HTML Mail.app
      • From: wayne melrose <email@hidden>
  • Prev by Date: Re: Display dialog and select button after so long - Final Code
  • Next by Date: Re: HTML Mail.app
  • Previous by thread: Re: Finder Selection Bug in Lion
  • Next by thread: Re: HTML Mail.app
  • Index(es):
    • Date
    • Thread