Re: Need help sending emails via AppleScript (without a mail client)
Re: Need help sending emails via AppleScript (without a mail client)
- Subject: Re: Need help sending emails via AppleScript (without a mail client)
- From: Axel Luttgens <email@hidden>
- Date: Sun, 10 Nov 2013 10:55:52 +0100
Le 9 nov. 2013 à 20:30, Christian Boyce <email@hidden> a écrit :
> I used to use the 24U Email OSAX but it's not working for me in 10.8, and I'm not getting anywhere trying to contact the 24U people (no response to multiple emails). I wonder whether anyone has a suggestion that will help me to send emails via AppleScript without bringing up a mail client-- another OSAX, a shell script, something. Does not have to be very flexible as every email will have the same sending and receiving addresses.
Hello Christian,
Assuming you have to send emails through your ISP's server (e.g. "myisp.relay.com"), you could make use of the /usr/bin/nc command. This is not the most reliable way, since one has to simulate a SMTP conversation by sending all commands in a batch, instead of waiting for the server's reply after each command; but for simple mail transactions, this should work most of the time.
Here's an example:
--
set Replies to do shell script "/usr/bin/nc myisp.relay.com 25 <<END_OF_DATA
ehlo [127.0.0.1]
mail from:<email@hidden>
rcpt to:<email@hidden>
data
From: John Doe <email@hidden>
To: Mary Jane <anotherdomain.com>
Subject: Test message
Hello
This is a test message.
Greetings,
John
.
quit
END_OF_DATA"
--
In case of successful submission, variable Replies should contain a line beginning with "250".
More generally, the value of that variable may prove helpful for diagnosing what the server doesn't like (e.g. a bracketed ip address instead of a host name in the EHLO command).
HTH,
Axel
_______________________________________________
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