Generating an HTML email in Eudora...
Generating an HTML email in Eudora...
- Subject: Generating an HTML email in Eudora...
- From: David Crowe <email@hidden>
- Date: Wed, 30 Oct 2002 13:23:00 -0700
I have been trying to find a solid way to generate an html email in
Eudora for some time, and I have finally come up with a solution I'm
comfortable with, so I thought I'd share it.
I had initially thought about changing the setting in Eudora
(<x-eudora-setting:9014>). But, I don't think this would work well,
because this setting is global, which means that you have to send all
ordinary emails, change the setting, send your html emails, and then
reset the setting. What happens if a time-delayed email comes due
just at this time, well, it probably gets set incorrectly.
A somewhat cleaner and more robust method is the following:
Generate html in some fashion (e.g. using FileMaker to set a text
field to the raw html, and then exporting that one field to a
temporary text file). Note that the format of the first few lines is
critical. I use:
From myemailaddress Fri Oct 25 08:08:08 2002
To: email@address
Subject: subject of email
Date: Fri Oct 25 08:09:10 2002
Using AppleScript do the following:
Convert the file type/creator type to TEXT/CSOm so that Eudora thinks
that the text file is a mailbox.
Modify the Vertical Tab characters (11) by carriage returns (13).
inserted by FileMaker which absolutely refuses to put a carriage
return in an exported file.
Open the file with Eudora. It will open it as a mailbox with one email
message
"send again" the email. This puts a copy in the Out mailbox
Delete the temporary text file.
This is the AppleScript that I use. The ugliest part is replacing the
vertical tab characters:
-- Take Meeting report from raw html file and queue enclosed email
(*
* Take temporary text file exported by FileMaker and persuade Eudora
to send it as email.
* This involves:
* - Changing Vertical Tab (ASCII 11) characters to carriage
returns (Bad Filemaker!)
* - Changing File type/creator to be a Eudora Mailbox
* - Telling Eudora to take the one email in the mailbox and "send
again"
* - Delete the temporary file
*)
property BlockSize : 512
--
set AFile to (":;Out Basket;:TempMeetingReport") as alias
set InputRef to (open for access AFile with write permission)
set FileSize to (get eof of InputRef) as integer
set FilePointer to 1
repeat while FilePointer < FileSize
if FilePointer + BlockSize > FileSize then
set n to FileSize - FilePointer
else
set n to BlockSize
end if
set Block to (read InputRef from FilePointer to FilePointer + n)
set BlockModified to false
repeat
set i to offset of ASCII character 11 in Block
if i > 0 then exit repeat
set BlockModified to true
set Block to text 1 through (i - 1) of Block & return
& text (i + 1) through n of Block
Block
end repeat
if BlockModified then write Block to InputRef starting at FilePointer
set FilePointer to FilePointer + n
end repeat
close access InputRef
-- Take Meeting report from raw html file and queue enclosed email
tell application "Finder"
set file type of AFile to "TEXT"
set creator type of AFile to "CSOm"
tell application "Eudora"
activate
open {AFile}
send again last message of mailbox "TempMeetingReport"
close mailbox "TempMeetingReport"
end tell
try
delete AFile
end
end tell
Note that you can figure out most of the format of the text file from
the header that I've given above (with appropriate substitutions) and
from turning on 'blah blah' on a Eudora email message formatted with
html. Note that the dates specified in the header are pretty
irrelevant, because "send again" resets the date to the present time.
Also note that if you are likely to have multiple simultaneous
FileMaker scripts running, you may need to ensure the uniqueness of
the temporary file name.
And, yes, I know that many people feel that html formatted emails are
the work of the devil, but it works for me!
Someone who's more expert at AppleScript could probably simplify the
above script, I still find aliases versus alias lists confusing.
Plus, "delete Afile" doesn't work if the file is already in the
trash, which is likely unless I include "empty trash" in the script
which would be even worse.
- David Crowe
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.