It worked actually although I didn’t see anything in applescripts log it still send now there is just 1 problem.
The message came through as text and “Subject: MIME Test Mime-Version: 1.0 Content-Type: text/html” appeared in the message body along with all the html code.
With what mail client did you open the mail? If it’s an text mail it will be presented as text and not as HTML, many webmail clients do this for example. If you’re using a mail client that should support html but still represent their message wrong, maybe you need this in the SMTP headers as well:
Content-Transfer-Encoding: 7bit
edit: NOTE: Apple Mail is making up two mail bodies in one single mail, a HTML version and a plain text version. You can do this too if you want.
I opened it up in iOS mail which I used when i was copy and pasting it into an email and it worked fine I will try with the encoding and see what happens.
Mmmm, that’s weird. I opened mine (copy of the latest AppleScript here) and the mail doesn’t show any HTML tags at all, I only see “this is a test” without the tags.
I used iOS 7.1.2 as well and it could be to do with my HTML I was using the webpage I want to send in the test because I need to know if it works with it. unfortunately it does not look like it works.
Hmm wonder what else I could try…
EDIT: I did try the encoding and not sure where to put it exactly
tell application "System Events" to set parentFolder to POSIX path of container of (path to me)
set filename to "Test.eml"
set mail to (parentFolder & "/" & filename)
do shell script "sendmail -t mail"
Unfortunately the result is “” and no email has been sent!
Sorry for late response, it’s our loss against Argentina from last night.
What you need to to i slike Stefan said bit the file contents needs to be send to sendmail, not the file name.
tell application "System Events" to set parentFolder to POSIX path of container of (path to me)
set filename to "Test.eml"
set mail to (parentFolder & "/" & filename)
do shell script "sendmail -t <" & quoted form of mail
edit: Like Stefan said. He was posting while was writing, sorry for double post.
Thanks guys for your responses but it still is showing “” and not sending anything.
I done it with and without < and it hasn’t made a difference.
tell application "System Events" to set parentFolder to POSIX path of container of (path to me)
set filename to "Test.eml"
set message to parentFolder & "/" & filename
do shell script "sendmail -t <" & quoted form of message
Before I left I did this and I noticed it worked but it ended up in both inboxes
tell application "System Events" to set parentFolder to POSIX path of container of (path to me)
set filename to "Test.eml"
set message to parentFolder & "/" & filename
do shell script "sendmail -t email@email.co.uk to address@address.com <" & quoted form of message
when the first email address is not there it send but it receives saying no sender.
Have you looked into your console? If there is anything wrong with the markup of the Mail or communication with the SMTP server you have to look there.
That is right. The 250 OK message indicates that everything has worked properly. A common issue now is that the mail could not be delivered to the proper mail box, something that is handled by the remote server (smtp.emailsrvr.com) and not by sendmail. You have defined a sender but make sure that <server@osx server domain.private> also accepts bounce backs from other mail servers (an informative mail that indicates what went wrong on the remote server). Another common issue is a spam filter who catches the mail and doesn’t deliver the mail properly in the inbox.