I changed over to GoDaddy for my web hosting.
The contact form on my website comes into Outlook 2011 with the subject line reading: form submission
The email address with the subject is: formmailer@secureserver.net
Changing reply to address
I want to reply to the requestor’s email address which is in the body of the message, not the address that the email is sent from. When we reply to the email, we would like the Requestor Email address to be in the To: field. Do you know how I could go about this?
I also would like to be able to create a contact card from the information received in the form.
Model: iMac
AppleScript: 2.5
Browser: Safari 537.11
Operating System: Mac OS X (10.8)
How I would do it in Mail is using an Automator workflow with some applescript and an action.
The run the workflow either as a Service or run from the Applescript Menu using another Applescript with a do shell script.
do shell script "/usr/bin/automator /Users/USENAME/Library/Services/makeReply.workflow"
The workflow example which you may be able to adapt.
1, Run Appliscript
tell application "Mail"
set theMessage to item 1 of (get selection)
set theBody to content of theMessage
end tell
return theBody
2, Extract email address from Text
set to Extract : email addresses
3, Run Appliscript
on run {input, parameters}
set text_returned to choose from list input with prompt "Choose address" default items "" without multiple selections allowed and empty selection allowed
if text_returned is not false then
tell application "Mail"
set t to item 1 of (get selection)
set rpMessage to reply t with opening window
set to recipient's address of rpMessage to text_returned
end tell
end if
end run
To Use: select an email. Run the workflow. the workflow get the first email selected.( ignores other emails if they are selected.) extracts the body text. Extracts emails from them. Offers a choice dialogue for you to choose the email address to use. then opens a reply email and sets the recipient.
Mark,
That’s for your reply.
I am not experienced enough to follow what you are doing with the script.
I tried copying it, but don’t really know what I’m doing.
Would you mind creating the entire workflow so I can copy it into AppleScript?
Thanks,
William
In Outlook 2010 the conversion is easy; all except changing the to recipient.
And I had to add a filter on the return email extraction.
So for the Outlook workflow. I have made it appear that it is a reply that pops up but it is actually a new message with all the ingredients of a reply.
My assumption is that the messages are not plain text but the default html.
tell application "Microsoft Outlook"
set theMessage to item 1 of (get selection)
set theBody to content of theMessage
end tell
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to "mailfrom:"
set theBody to text item 2 of theBody
set AppleScript's text item delimiters to ""
return theBody
2, Extract email address from Text
set to Extract : email addresses
3, Filter Paragraphs
Return Paragraphs that: do not begin with mailto:
4, Run Appliscript
on run {input, parameters}
set text_returned to item 1 of input
--set text_returned to (choose from list input with prompt "Choose address" default items "" without multiple selections allowed and empty selection allowed)
if text_returned is not false then
tell application "Microsoft Outlook"
set t to item 1 of (get selection)
set recip to email address of to recipient of t
set theFrom to address of item 1 of recip
set theRecDate to time sent of t
set subj to subject of t
set body to "<br><br><span id=\"OLK_SRC_BODY_SECTION\"><div style=\"font-family:Calibri; font-size:11pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt\">
From: " & quoted form of text_returned & "
<br>Date: " & theRecDate & "
<br>To: " & theFrom & "<br>Subject: " & subj & "
<p>" & content of t & "</p>"
set newMessage to make new outgoing message with properties {subject:("RE: " & subj as string), content:body}
make new recipient at newMessage with properties {email address:{name:"", address:text_returned}}
open newMessage
end tell
end if
end run
Nice. Thank you very much.
I have installed it into the services menu, but don’t know how to access that via outlook.
Or, do I have to run automater each time I want to run the script?
While in Outlook, You should see a script menu icon in the menu bar after the Help menu.
Click it and got to About this Menu.
Read the info so you understand what is going on. Then click the button to 'Open Folder".
Put a copy of the workflow in the folder. (You do not have to put it in the Sample Folder that in there.)
Close the folder.
Go back to Outlook.
Select a message.
I must need to rename it or something. I can get it into the folder, but it won’t run.
I put this into the folder: replyToSubmitterMailOUTLOOK2010.workflow
I changed it to OUTLOOK2011 because that’s the version I’m running.
It does run in automater, but not in the script menu.
Also, instead of creating a reply email, can the script be setup to open a new contact and add the email address and name to the contact page? I would also like it to somehow attach the incoming email to the contact page for future reference.
I have UPDATED the above Post to fix some errors ( from and to email placement) and also redone the workflow. You do not get the dialogue any more as I can filter the mail from: now.
I suspect the reason why it will not work from your Outlook script menu is because you removed the .worflow extension.
Doing this makes your Mac think the workflow is a folder. Automator Workflows are packages (folders) put must have the .workflow extension to tell the system it is to be treated as such and not a folder.
Mark,
It appears that the workflows in outlook 2011 have an added character to the naming convention.
Below are the workflows included with outlook and the Contact Reply workflow you created.
What happens when I run the workflow in outlook is nothing. But the menu then gets grayed out and I have to restart outlook to make the menu active again.
Anyway, I can run it as a application - I just keep it in the dock and run it that way. Thanks for the update, it works seamlessly.
The contact workflow is something I’ve always wanted. I have thousands of contacts in outlook and inputed all of them manually from the contact form from my website.
Contact Reply.workflow
Convert message text to audio and send to an iPod\sc-.workflow
Create a .zip archive for specified messages\scl.workflow
Edit selected contacts\scn.workflow
Edit specified contacts\sco.workflow
Flag selected messages for follow-up\scs.workflow
Print selected messages\scq.workflow
Send image attachments to iPhoto\sct.workflow
Send images on the current Safari Web page in a message\scw.workflow
Send specified images in a message\scg.workflow
Send the current Safari Web page URL in a message\scu.workflow
Send the system profile in a message\scp.workflow
Ok here you go. since you seemed to have missed my subtle little nudge that you do need to try and work out some of this yourself.
If you need any adjustments please try and figure it out first before asking. We like to help but not always to do it all for you…
set name_ to {"name: ", ""}
set address_ to {"address: ", ""}
set citytown_ to {"citytown: ", ""}
set statezip_ to {"statezip: ", ""}
set mailfrom_ to {"mailfrom: ", ""}
set telephone_ to {"telephone: ", ""}
set foundus_ to {"foundus: ", ""}
set galleryname_ to {"galleryname: ", ""}
set Lamp_1_ to {"Lamp_1: ", ""}
set textareaName_ to {"textareaName: ", "textareaName: "}
set store to {name_, address_, citytown_, statezip_, mailfrom_, telephone_, foundus_, galleryname_, Lamp_1_, textareaName_}
tell application "Microsoft Outlook"
set theMessage to item 1 of (get selection) # get the first email message
set theBody to (plain text content of theMessage) # get plain text message content
end tell
# we are now going to break the content into paragraphs.
# set the delimiters to the carrige return used in outlook. This is \r instead of \n
set AppleScript's text item delimiters to ""
set AppleScript's text item delimiters to return
#get the seperated items.
set newPara to text items of theBody
# set the delimiters to their normal setting
set AppleScript's text item delimiters to ""
#we are now going to iterate through each variable item listed in the store list. We will access its item values
repeat with i from 1 to number of items in store
#get the first item of an item in store i.e from {"name: ", ""} we get "name: "
set this_item to item 1 of item i of store
#we are now going to iterate through each paragraph item in the new newPara list
repeat with z from 1 to number of items in newPara
#get an item in newPara . i.e "name: Tootsie Roll"
set this_para to item z of newPara
#we check to see if the newPara item contains the store item. i. e, does "name: Tootsie Roll" contain "name: "
if this_para contains this_item then
# if it does then we set the delimiters to the store item i.e "name: "
set AppleScript's text item delimiters to this_item
#now we get the item to the left of the split. i.e from "name: Tootsie Roll" we get 'Tootsie Roll".
# note is there was text on the other side of the delimiter("name: ") we would call it text item 1
#now we set the second item of the item in the store item to the value of text item 2. i.e where we had {"name: ", ""} we will now have {"name: ", "Tootsie Roll"}
set item 2 of item i of store to text item 2 of this_para
# set the delimiters to their normal setting
set AppleScript's text item delimiters to ""
#exit this sub loop as their is no need to test further. we can now go back to the start of the first repeat loop and pick up the next item in the store items
exit repeat
end if
end repeat
end repeat
#we are now out of the repeat loops and should have all our info ready to use stored in the store items.
# we now make sure the note field is only filled with worthy text.
if item 2 of textareaName_ contains "Please type your message here." then
set item 2 of textareaName_ to ""
end if
#we now get the first name
set theFirstName to word 1 of item 2 of name_ as string
#we now get the surename/s
set theLastName to characters -1 thru word 2 of item 2 of name_ as string
#now we write it all out using the new second items of the variables
tell application "Microsoft Outlook" to make new contact with properties {first name:theFirstName, last name:theLastName, business street address:item 2 of address_, business city:item 2 of citytown_, business zip:item 2 of statezip_, email addresses:{{address:item 2 of mailfrom_, type:work}}, phone:item 2 of telephone_, custom field one:item 2 of foundus_, company:item 2 of galleryname_, custom field two:item 2 of Lamp_1_, note:item 2 of textareaName_}