[ANSWERED]Send Email Using Variable Content as Address
Posted: Mon Jul 28, 2014 2:55 pm
Hey,
I have a script I've been using to capture a webcam image and mail it to the address contained in a variable.
Works great in 10.5.8 but errors out using 10.8.
The format, I believe the script wants for the sender is {"test@test.com"}
I used the ASCII code for the " symbol in the address as I couldn't use a " directly in the applescript.
This code works fine in 10.5.8
Here are a couple images of the error in 10.8
Any help greatly appreciated!
Thanks,
Carl
I have a script I've been using to capture a webcam image and mail it to the address contained in a variable.
Works great in 10.5.8 but errors out using 10.8.
The format, I believe the script wants for the sender is {"test@test.com"}
I used the ASCII code for the " symbol in the address as I couldn't use a " directly in the applescript.
This code works fine in 10.5.8
- Code: Select all
tell application "SecuritySpy"
capture image camera number 0 as "/Users/JD/Pictures/ss/0.jpg" with overwrite
end tell
tell application "IndigoServer"
set theInsert to "This attached image was taken at " & value of variable "ClockTimeAmPm" & " with your front camera." & return & return & "Have a terrific " & value of variable "TimeOfDayShort" & "!"
set PrintDateTimeName to value of variable "DayDate"
set the_mailto to "{" & (ASCII character 34) & value of variable "CamMailAddress" & (ASCII character 34) & "}"
--set the value of variable "CamMailAddressTest" to the_mailto
end tell
set theSenderTemp to "info@whitefishxxxxxxx.com"
set nameList to {"Customer"}
set TheName to "Front Webcam"
set the_subject to "Alert! Motion Detected From Front Camera."
set the_content to ("Hey," & return & return & "This is an automated message from your Indigo Security System." & return & return & theInsert & return & return & "To report a problem with your system contact " & theSenderTemp & "." & return & return & "Your image from, " & TheName as text) & ", from the folder " & PrintDateTimeName & " has been backed up into the folder Security Cameras." & return & return
tell application "Mail"
activate
set attachmentVar to "/Users/JD/Pictures/ss/1.jpg"
set newMessage to make new outgoing message with properties {address:the_mailto, subject:the_subject, content:the_content}
tell newMessage
set x to offset of "Indigo Security System." in the_content
repeat with y from 0 to count of "Indigo Security System."
set font of character (x + y) of content to "Helvetica Bold"
set color of character (x + y) of content to {48632, 1630, 1102}
end repeat
set x to offset of TheName in the_content
repeat with y from 0 to count of TheName
set font of character (x + y) of content to "Helvetica Bold"
end repeat
set x to offset of PrintDateTimeName in the_content
repeat with y from 0 to count of PrintDateTimeName
set font of character (x + y) of content to "Helvetica Bold"
end repeat
set x to offset of "Security Cameras." in the_content
repeat with y from 0 to count of "Security Cameras."
set font of character (x + y) of content to "Helvetica Bold"
set size of content to (17)
end repeat
make new attachment with properties {file name:attachmentVar}
repeat with i from 1 to count nameList
make new to recipient at end of to recipients with properties {name:item i of nameList, address:item i of the_mailto}
end repeat
send
end tell
end tell
Here are a couple images of the error in 10.8
Any help greatly appreciated!
Thanks,
Carl