I am able to use Xmail when testing as a script by itself:
send mail to {"user@domain.com", "user2@domain.com"} from "me@mydomain.com" subject "New pictures added" body "blabla" SMTP server "smpt.mailserver.com" extra headers {{"reply-to", "nobody@mac.com"}}
But when I try to integrate it with my ftp script, it won’t send mail.
(* FTPupload is an Action Folder script to silently upload to an FTP server the files/folders added to a folder. It requires NcFTP, a free program you can download here: <http://www.ncftp.com/download/>. I decided to use NcFTP instead of the built-in FTP command, because NcFTP can upload whole folders. You have to set your personal FTP parameters at the top of the script. *)
-- Author: Fabrizio Costantini thefabmac@users.sourceforge.net
property theUserid : "myusername"
property thePassword : "mypass"
property theServer : "[url=ftp://ftp.domain.com]ftp.domain.com[/url]" -- e.g. "[url=ftp://ftp.apple.com]ftp.apple.com[/url]"
property theRemotePath : "/public_html/bla" -- mandatory: use "/" for root directory
on adding folder items to this_folder after receiving these_items
tell application "Finder"
set thePath to quoted form of POSIX path of (this_folder as alias)
set theFiles to ""
repeat with theItem in these_items
set theFiles to theFiles & "\"" & (name of theItem as text) & "\" "
end repeat
do shell script "cd " & thePath & "; ncftpput -R -u " & theUserid & " -p " & thePassword & " " & theServer & " " & theRemotePath & " " & theFiles
end tell
send mail to {"user@domain.com", "user2@domain.com"} from "me@mydomain.com" subject "New pictures added" body "blabla" SMTP server "smpt.mailserver.com" extra headers {{"reply-to", "nobody@mac.com"}}
end adding folder items to
I hope an expert out there can tell me what I am doing wrong.
on ...
tell app (path to frontmost application as text) to display dialog "going to send email..."
try
send mail...
on error msg
tell app (path to frontmost application as text) to display dialog "ERROR:"&return&return&msg
end
tell app (path to frontmost application as text) to display dialog "email sent..."
end
I’m pretty noob when it comes to this, so let me show you how I added your debug info to be sure I did it correctly:
property theUserid : "myusername"
property thePassword : "mypass"
property theServer : "[url=ftp://ftp.domain.com]ftp.domain.com[/url]" -- e.g. "[url=ftp://ftp.apple.com]ftp.apple.com[/url]"
property theRemotePath : "/public_html/bla" -- mandatory: use "/" for root directory
on adding folder items to this_folder after receiving these_items
tell application (path to frontmost application as text) to display dialog "going to send email..."
tell application "Finder"
set thePath to quoted form of POSIX path of (this_folder as alias)
set theFiles to ""
repeat with theItem in these_items
set theFiles to theFiles & "\"" & (name of theItem as text) & "\" "
end repeat
do shell script "cd " & thePath & "; ncftpput -R -u " & theUserid & " -p " & thePassword & " " & theServer & " " & theRemotePath & " " & theFiles
end tell
try
send mail to {"user@domain.com", "user2@domain.com"} from "me@mydomain.com" subject "New pictures added" body "blabla" SMTP server "smpt.mailserver.com" extra headers {{"reply-to", "nobody@mac.com"}} on error msg
tell application (path to frontmost application as text) to display dialog "ERROR:" & return & return & msg
end try
tell application (path to frontmost application as text) to display dialog "email sent..."
end adding folder items to
When the folder action runs, I get the following popup message:
ERROR:
<> doesn’t understand the <>
message
I searched google for ‘MISuMISd’ but couldn’t find a darn thing.
Hmmm… No idea. I’ve tested and it works here:
-Where did you install XMail?
-What does it happen if you save and run a plain “send mail” as application? (try both as “application” and “application bundle”)
I would try later uninstalling XMail, restarting, then installing a fresh copy and trying again.
If it doesn’t work, I would try passing a report to the author, just in case it’s a know issue fixed in the incoming version 3.7…