Mail attachments

HI everyone

I have been having problems with inline attachments created via applescriipt appearing distorted on windows machines (also Hotmail)

Is there a way through scripting that I can create a ‘proper’ attachment, ie on that is not inline

In general, Mail has the option to send “windows friendly” attachments. This is probably what you need. However, I don’t see a way to specify that through applescript. As such my best advice would be to zip all of your attachments. A zip file should be windows friendly.

Thanks Regulus

Can you script zip via Applescript?

Sure, you can zip something with this…

set itemToZip to (choose file) as text
if itemToZip ends with ":" then set itemToZip to text 1 thru -2 of itemToZip
set zipPath to itemToZip & ".zip"

do shell script "/usr/bin/ditto -c -k -rsrc " & quoted form of POSIX path of itemToZip & " " & quoted form of POSIX path of zipPath

This will work with a folder too by using “choose folder”. So if you have more than 1 attachment then you can zip each item individually or put them all in one folder and zip the folder.

Whoa Thanks Regulus

Saved me a few hours digging.

Respect

Actually you may want to use the “–norsrc” switch instead of the “-rsrc” switch since you’re sending them to a windows machine which doesn’t use resource forks.

Glad to help! :smiley: