Mail rule message content as variable
I run a minecraft serer, and i need a way to promote a player when they fill in a form on the website. Every time a player filles in the form, I get an email like this:
New application for member:
Naam: <name of the pearson>
Username: <minecraft username of the person>
Skype naam: <skype name of the person>
E-mail: <email of the person>
Nieusbrief: <Whether they want to get the newsletter or not>
I know there is a way to setup a mail rule that runs an applescript, and from that I can run a shel script, but is it posible to feed the playername to the shel script script as a variable? So from the mesage body to the apple script, and from the apple script th the shel script. First problem I face is getting the username to the apple script. Then there is the second problem: I know there is an run-shel-script thingy, but i'm not sure how to pass the variable on from the apple script to the shel scrip. (I don't have anny experience with apple scripts...)
Anny help is appreciated.
Hi Stefan,
Thanks for your reply. I am glad to hear that I am wrong again )
In your opinion is it possible to force the Outlook Exchange server to add the content attachment every time? I mean by doing some configuration on it...?
The reason why we would like to do this is because when - in the content tag of a Mail Package message - we have MIME message parts that are of content-type text/html we are having problems in decoding the html back to a readable format.
To do this we use the apache QuotedPrintableCodec Java class.
This works fine when the content type of the message is just text/plain but we get an exception when we try with text/html.
The exception we get is:
org.apache.commons.codec.DecoderException: Invalid URL encoding: not a valid digit (radix 16): 13
I don't know if this is because of the two character sets we have in the payload (utf-8 and iso-8859-1) or if it is for other reasons...
If you could help me figure out how to forward any HTML email to another system in a readable format it would be great.
Thanks for your support,
Aldo
Similar Messages
-
Mail 4.2, snow leopard, mail without message content
New MacBookPro owner running Mac OS 10.6.2. Migrated everything from older Powerbook Titanium without thinking that through. All of migrated mail AND even new mail comes in with headers but without the message content unless I elect to "rebuild" the mail box each time. Is this a setting issue or what am I doing wrong? I have numerous mail addresses all being managed by mail. No problem on Powerbook but irritating with Mac Book Pro. Help?
rebuild your whole mail index. quit Mail and delete the file home directory/library/mail/envelope index. start mail and say yes when it asks to import your messages.
-
Mail Rule seems to be confusing messages
This script extracts email addresses from the body of a message and resends the message to each of the extracted addresses. It works well when one message arrives at a time. However, when several messages arrive at once, it often sends a message to the wrong address. The script is very straight forward, yet I am not sure what is going on. Any ideas?
property debug : false
property choAddress : "[email protected]"
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with aMessage in theMessages
-- Extract addresses from message content
set messageContent to aMessage's content
set messageSubject to aMessage's subject
set mAddresses to my extractAddresses(messageContent)
-- Build a unique list of addresses
set uAddresses to {}
repeat with mAddress in mAddresses
set mAddress to contents of mAddress
if mAddress ≠ choAddress and mAddress is not in uAddresses then set end of uAddresses to mAddress
end repeat
-- Forward messages to each extracted address
repeat with uAddress in uAddresses
set newMessage to make new outgoing message at the beginning of outgoing messages with properties {sender:choAddress, subject:messageSubject}
tell newMessage
make new to recipient at beginning of to recipients with properties {address:uAddress}
set content to aMessage's content
if debug then
set visible to true
else
send
delay 1
end if
end tell
end repeat
delay 1
end repeat
end tell
end perform mail action with messages
end using terms from
on extractAddresses(mContent)
try
-- Thanks Nigel Garvey
set extractedAddresses to paragraphs of (do shell script "echo " & quoted form of mContent & " | grep -Eo '[[:alnum:]][^[:space:]<>@\":;]+@[^ <>\"]+[][:alpha:]]'")
on error
error number -128
end try
end extractAddressesSorry but my AppleScript is too rusty to wade through your script. However, a while ago I wrote a script to extract email addresses from an emailed web form with a defined format and send a reminder 4 days later with a specified message.
I opted to use a mail rule to put a copy of specified messages into another mail folder - this may be more reliable for you.
For my 4 day delay I set a 'Users Daemon' to run an AppleScript every hour. This is more efficient and reliable than setting delays in AppleScript.
The most tedious task is parsing for all possible email formats - check email RFCs if you doubt this.
This script was not completed but the sections I tested on Leopard worked well. Here is the incomplete script - just in case you find something useful:
tell application "Mail"
set fourDays to 345600 -- normally 345600 but can be 0 for testing
repeat with lastMsg from (count messages of mailbox "Pending") to 1 by -1
try
set thisMsg to message lastMsg of mailbox "Pending"
end try
if (current date) - (date sent of thisMsg) > fourDays then
set txt to content of thisMsg
set AppleScript's text item delimiters to {"Email id"}
set newRecipient to paragraph 3 of text item 2 of txt
set html to source of thisMsg
set AppleScript's text item delimiters to {"<body bgcolor=\"#FFFFFF\" text=\"#000000\">"}
set bodyPlus to text item 2 of html
set AppleScript's text item delimiters to {"</html>"}
set oldBody to text item 1 of bodyPlus
set newMsg to make new outgoing message with properties {sender:"[email protected]"}
tell newMsg
make new to recipient with properties {address:newRecipient}
set subject to "Your Heating Oil Order"
set html content to "<html><body bgcolor='#FFFFFF' text='#000000'>
<!-- Use normal html with inline style after this line - do not use double quotes -->
<br>
<hr style='color:pink; background-color:pink; height:4px; width:60%; text-align:middle'>
<br>
<p style='color:red; font-size:xx-large'>Thank you for placing your heating oil order with us.</p>
<p style='color:brown; font-size:x-large'>I would appreciate feedback (good or bad) about how your oil delivery went.</p>
<p style='color:blue; font-size:medium'>Please contact me if you experienced any difficulties with your order.</p>
<br>
<p style='color:navy; font-size:medium'>Sincerely,<br>
<br>
Peter Pan</p>
<br>
<hr style='color:pink; background-color:pink; height:4px; width:60%; text-align:middle'>
<!-- End of extra html - original message follows -->
<br>" & oldBody & "</html>"
send -- normally send but can be set to save to put email in Drafts for testing
end tell
delete thisMsg -- normally delete thisMsg but can be removed for testing
end if
end repeat
end tell -
I went through all the steps to try to resolve getting the message in a box every time i try to send an e-mail. What next ?
Message is " A copy has been placed in your
Outbox. Sending the message content to the server failed."
Any assistance would be greatly appreciated. My internet works fine as I can send e-mails from my Yahoo account on my MAC no problem.
Address is fine etc.How long has it been going on? I've had my yahoo mess up and if i wait a bit it resolves itself. Yahoo is doing something with their servers and it messes with your mail if your mail happens to be on one of those servers.
-
I can no longer send mail....today I cannot get mail..., I can no longer send mail....today I cannot get mail...a message pops up that says:A copy has been placed in your outbox.Sending the message content to the server failed....any help?
How long has it been going on? I've had my yahoo mess up and if i wait a bit it resolves itself. Yahoo is doing something with their servers and it messes with your mail if your mail happens to be on one of those servers.
-
I have a rule in Mail: Move messages that were sent to a particular accout, to a particular mailbox. It moves the message like it's supposed to but if there are attachments over about 1 MB the attachment is no longer there, and instead there's a bunch of code in the body of the message. With smaller attachments, the message appears in the new mailbox with the file attached, just as expected. Anybody know what's up? Thanks, Bob
You can't simply feed it some arbitrary script to execute, you have to write a handler that Mail can dispatch events to. This generally looks something like
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
tell application "Mail"
repeat with suspectMessage in theMessages
--do something
end repeat
end tell
end perform mail action with messages
end using terms from -
How do I make a Mail Rule action bounce a message
Is there a way to have a Mail Rule action bounce a message?
Thank you in advance.
Jeffpaste the following into Applescript Editor and save it as a script
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #ADD8E6;
overflow: auto;"
title="this text can be pasted into the Script Editor">
using terms from application "Mail"
on perform mail action with messages selectedMsgs
repeat with msg in selectedMsgs
tell application "Mail"
bounce msg
end tell
end repeat
end perform mail action with messages
end using terms from</pre>
then have your Mail rule execute this script. -
Paypal email message content not found in Mail search
I've looked on the net and can't find any one else reporting this problem so it has to be something at my end.
My Mail search cannot find any word found in the message body of an email from Paypal.
I just upgraded to Yosemite so thought it was a problem with the new OS as I've been able to search message content in OS 10.8 (and previous) for years.
However...
I just re-started using a cloned HD with my old 10.8 OS on it and the search isn't working now.
It finds everything else asked but nothing in a Paypal email.
This includes messages in my inbox and messages stored in various "On My Mac" folders.
I seem to remember this happened before, maybe 2004/2005?? Which ever OS version I was using then?
It couldn't be worked out so I moved over to Microsoft Entourage.
I don't want to switch email software again but the lack of ability to search is causing me some problems.
I did open an Apple support case on this and they couldn't give me an answer but said it had been reported already and may be looked at for a fix in forthcoming OS revisions.
Funny how no one's asked this on any community pages.
Any ideas?? Am I missing something. I don't understand how it's worked on my older OS for years and now suddenly it's stopped.
Does search need anything to find words in content that I may have inadvertently changed?I have now gone back to my OS 10.8 disc and re-built the folder with my paypal emails in and it is now searching ok so forget what i said earlier.
I'd edit the original post but it won't let me??? -
In my Mac Mail Version 4.5, I am not received email pdf attachement. It is shown in some html like form in message content. Please help
Erdygirl please be aware you are posting to a public forum. I have removed your personal information from your previous post.
Please check your account at http://www.adobe.com/ to locate your serial number. You can find more information on how to locate your serial number at Find your serial number quickly - http://helpx.adobe.com/x-productkb/global/find-serial-number.html. -
Applescript process message body from mail rule help please
Would someone be kind enough to help me figure out how to do this? I've been reading for hours on other posts and I can't get this to work.
Here is an example:
I would like to set up a mail rule to run an applescript that searches the body of the email for "-Front Door- Open". I then want to parse the body and sets myDevice= "-Front Door-" and myState="Open". After I have these variables set, I want to make an call to something like https://foo.me.com/api/token/${state.accessToken}/smartapps/installations/${app.id}/Notify?device=${myDevice}&type=ContactSensor&state=${myState}
I understand how to do the mail rule, I just can't figure out the applescript part of it.The script works just fine - at least, as designed if not as expected.
When the script runs, Mail and/or AppleScript looks for a perform mail action handler. If that is found, the commands within are executed.
If there is no perform mail action handler then the script is run as-is (i.e. as if you clicked 'Run' in AppleScript Editor).
And that's exactly what's happening here. In the first case (that works) the script is running because there's no (visible) perform mail action handler.
In the second case where it apparently doesn't work, there is a handler, so that handler is being executed. Any code outside that handler is ignored (unless it's called from within the perform mail action handler.
Since your 'say' command is outside the handler, it is ignored. However, if you move it inside the perform mail action handler you'll hear your speech. -
Mail sender and subject mismatch with message content
I have just started to find a few messages here and there that have a sender and subject which does not match the message content. The frequency of this behavior seems to be increasing. The senders are people I do get mail from and the message content looks like something I would receive from another recognized sender but they don't match. Anyone have any ideas?
Thanks in advance.Never mind. A little more searching solved the problem.
http://discussions.apple.com/thread.jspa?messageID=11969642� -
Apple Removed Mail Search by Message Content in Lion 10.7.2
Just got off the phone with Apple Support. As usual, they are very helpful. However, I was disappointed to learn that Apple silently removed the ability to search mail by content in the latest update to OSX.
I have OSX Lion 10.7.2, and when I type anything into the search field in Mac Mail (or, interestingly, onwww.me.com), there are options to search only by subject or sender or recipient, not by message content as there used to be.
According to Emily at Apple Support, Apple intentionally removed the search by content feature because "it wasn't working right". They are or MAY be working to add it back in to the next update. No commitments.
Sadly, there was no mention of this DOWNGRADE at the time I installed 10.7.2. And, the knowledge base article herehttp://support.apple.com/kb/DL1458 makes no mention of Mail changes either.
Sad. Confused. And a little bit angry. Apple can and should do better.Sad. Confused. And a little bit angry. Apple can and should do better.
Well, I agree with #2 out of 4.
I have no problems searching by content in OS 10.7.2. As Barney says, it's the default search state now. -
Mail confirm messages; rules
Is there any way of getting rid of mail confirmation messages; for example, when I want to bounce a message, I shouldn't have to see a dialog box every time. After all, I can delete a message without having to see a confirmation dialog box. Is there some kind of hidden preference for this?
I want to create a rule as follows:
Message is from some sender AND the word "foo" is not found more than five times in the message body.
Is this possible? If so, how?
I get a digest of "foo" several times a day; however most of the messages in the "foo" group have nothing to do with "foo" -- they are about "bar" or are spam. I'd like the digests that aren't about "foo" to go directly into the trash, but the word "foo" is found at the beginning and end of the message -- at the top where the group name is, and at the bottom where the subscribe/unsubscribe information is.
Thanks in advance.Check the iCloud.com website and look for a rule that may have been created there.
-
Need assistance accessing mail message content. Message display in inbox, but content cannot be viewed. I have attempted reindexing without success. Send, compose and receive all work fine. When opening content of message, the mail app crashes.
Mail: Troubleshooting sending & receiving email messages
-
Using Mail Rules, how do I remove from inbox my moved messages?
My goal is decluttering my inbox, so all mailing list group messages go to their respective mailboxes, and my general inbox only shows personal messages.
In Mail 7.0 under Mavericks, I can use Rules to move a message to an IMAP folder on a remote server or to a mailbox folder on my Mac. An example would be moving to a folder all the mail from a particular sender, like a Yahoo group, so I can go to that folder and see in on eplace all the mail related to that sender.
However, when a message has been moved to another folder, that mail message remains in the general inbox. I want such moved messages to vanish from my general inbox at the same time as they are moved to distinctive mailbox folders by the Rules filters.
Smart mailboxes may help, but my attempts so far have not made the moved messages leave my inbox. I may well be missing something, though.
FYI, under Mountain Lion, using Mail Rules, I was able to move some specific types of mail to a mailbox folder on my Mac, and in those cases the mail did vanish from my inbox. The problem was the this rule protocol worked in a few cases but not in most of the others, so the results were inconsistent. Also, moving the mail to a folder on my Mac consumed disk space, so I would rather move messages to a folder on a remote mail server, so my computer keeps more free disk space, but I do not know who to make such moved message leave my inbox.
I am wide open to experienced users sharing your wisdom.Install this add-on: https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/
Maybe you are looking for
-
Unable to delete emails from care4free using thunderbird
I have just bought an imac and have transfered my thunderbird account from my old pc. I am unable to delete messages from my care4free POP account. Anyone help with this please?
-
ANY Way to Increase TM Back up speed????
I'm fed up with the SLOWNESS of Time Machine Backups, why is it that it's SNAIL slow??? So I went to carbon copy cloner and in FOUR minutes CCC has done more work that TM in 3 HOURS!!!!! WTH!! I'm using WD Firewire External and there is no reason at
-
Making black and white copies with the tri- color ink
I would like to know if using tri-color ink to print blank and white copies, drain the color ink too much when compared to using a black ink?
-
Organizing Complilations to One Album ?
Whenever I add a compilation to my library, iTunes sees each track as a separate album. Is there a nice way (specifically when viewing with cover flow) to not have to scroll through 20 album-covers for one album?
-
Problem installing OSX 10.4 from Firewire DVD drive
Hi, I'd be very grateful if anyone can help... I've been trying to install OSX 10.4 from DVD loaded in an external Firewire Lacie DVD drive and haven't been successful yet. I have tried instructing startup from the DVD in System Preferences, holding