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)
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
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|
end
/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.