Hello,

I am looking for an AppleScript that I can call up as part of a rule
to automatically remove a specific phrase from the subject line of
incoming mail.

Basically, my employer recently began using Spam Assassin on the mail
gateway to screen all incoming email. When Spam Assassin detects spam
it adds the phrase "===SPAM===" to the beginning of the subject line.
Spam Assassin manages to catch some spam, but it also marks a lot of
legitimate mail as spam as well. Roughly half of the mail entering my
inbox these days is incorrectly marked as spam.

I currently use SpamSieve to manage my spam locally ? with great
success.

What I would like to do is find an AppleScript that I can call up as
part of a Rule to remove the "===SPAM===" from the subject line of
incoming mail. Then I will send the mail through SpamSieve for proper
spam detection.

I have been looking around on the net for a couple of weeks and all I
have been able to find are scripts that allow you to change the
subject of individual messages with a dialog box. These work well, but
I would like something a bit more automated.

If anyone knows of such a script, please point me to it.

Thanks in advance...

greg

Re: Script to change subject by Barry

Barry
Fri Dec 26 11:35:06 CST 2003

> This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

--B_3155304993_18501159
Content-type: text/plain;
charset="US-ASCII"
Content-transfer-encoding: 7bit

On 25/12/03 4:08 pm, in article
15d04376.0312250808.4862550d@posting.google.com, "Greg" <ghumpy@rmit.edu.au>
wrote:

> Hello,
>
> I am looking for an AppleScript that I can call up as part of a rule
> to automatically remove a specific phrase from the subject line of
> incoming mail.
>
>
> greg

Try this. Assuming the marker is placed at the beginning of the subject line
it should work. If the marker is elsewhere, have a go a modifying it!


property subjectText : "===SPAM==="
tell application "Microsoft Entourage"
set theMess to item 1 of (get current messages)
set theSubject to subject of theMess
if theSubject begins with subjectText then
set the subject of theMess to text (length of subjectText) thru -1
of theSubject
end if
end tell
--
Barry Wainwright
Microsoft MVP (see http://mvp.support.microsoft.com for details)
Seen the Entourage FAQ pages? - Check them out:
<http://www.entourage.mvps.org/toc.html>

Please post responses to this newsgroup. If I ask you to contact me
off-list, remove '.INVALID' from email address before replying.


--B_3155304993_18501159
Content-type: text/html;
charset="US-ASCII"
Content-transfer-encoding: quoted-printable

<HTML>
<HEAD>
<TITLE>Re: Script to change subject</TITLE>
</HEAD>
<BODY>
<FONT FACE=3D"Verdana, Helvetica, Arial"><SPAN STYLE=3D'font-size:10.0px'>On 25=
/12/03 4:08 pm, in article 15d04376.0312250808.4862550d@posting.google.com, =
&quot;Greg&quot; &lt;ghumpy@rmit.edu.au&gt; wrote:<BR>
<BR>
<FONT COLOR=3D"#0000FF">&gt; Hello,<BR>
&gt; <BR>
&gt; I am looking for an AppleScript that I can call up as part of a rule<B=
R>
&gt; to automatically remove a specific phrase from the subject line of<BR>
&gt; incoming mail.<BR>
&gt; <BR>
&gt; <BR>
&gt; greg<BR>
</FONT><BR>
Try this. Assuming the marker is placed at the beginning of the subject lin=
e it should work. If the marker is elsewhere, have a go a modifying it!<BR>
<BR>
<BR>
property subjectText : &quot;=3D=3D=3DSPAM=3D=3D=3D&quot;<BR>
tell application &quot;Microsoft Entourage&quot;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;set theMess to item 1 of (get current messages)<BR>
&nbsp;&nbsp;&nbsp;&nbsp;set theSubject to subject of theMess<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if theSubject begins with subjectText then<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;set the subject of theMess =
to text (length of subjectText) thru -1 of theSubject<BR>
&nbsp;&nbsp;&nbsp;&nbsp;end if<BR>
end tell<BR>
-- <BR>
Barry Wainwright<BR>
Microsoft MVP (see <a href=3D"http://mvp.support.microsoft.com">http://mvp.su=
pport.microsoft.com</a> for details)<BR>
Seen the Entourage FAQ pages? - Check them out:<BR>
&nbsp;&nbsp;<a href=3D"http://www.entourage.mvps.org/toc.html">&lt;http://www=
.entourage.mvps.org/toc.html&gt;</a><BR>
<BR>
Please post responses to this newsgroup. If I ask you to contact me off-lis=
t, remove '.INVALID' from email address before replying.<BR>
</SPAN></FONT>
</BODY>
</HTML>


--B_3155304993_18501159--


Re: Script to change subject by nospam>rmit

nospam>rmit
Sat Dec 27 07:31:31 CST 2003

Barry,

Thank you very much for the script. It appears to work perfectly and do
the job.

I did do a little modification to your script to deal with a space that
appears after the "===SPAM===" tag that is added to the subject. I am
far from even being a novice scripter, but after a bit of tweaking I
have come up with something that seems to work.

Here is the slightly modified script. Have a look and see if I did it
correctly.

property subjectText : "===SPAM=== "
tell application "Microsoft Entourage"
set theMess to item 1 of (get current messages)
set theSubject to subject of theMess
if theSubject begins with subjectText then
set the subject of theMess to text ((length of subjectText) + 1) thru
-1 of theSubject
end if
end tell

Again thanks for the script. It has removed a fair bit of frustration
from my emailing.

greg

--------------------------

Barry N. Wainwright wrote:
> On 25/12/03 4:08 pm, in article
> 15d04376.0312250808.4862550d@posting.google.com, "Greg"
> <ghumpy@rmit.edu.au> wrote:
>
>> Hello,
>>
>> I am looking for an AppleScript that I can call up as part of a rule
>> to automatically remove a specific phrase from the subject line of
>> incoming mail.
>>
>>
>> greg
>
> Try this. Assuming the marker is placed at the beginning of the subject
> line it should work. If the marker is elsewhere, have a go a modifying it!
>
>
> property subjectText : "===SPAM==="
> tell application "Microsoft Entourage"
> set theMess to item 1 of (get current messages)
> set theSubject to subject of theMess
> if theSubject begins with subjectText then
> set the subject of theMess to text (length of subjectText) thru
> -1 of theSubject
> end if
> end tell
> --
> Barry Wainwright
> Microsoft MVP (see http://mvp.support.microsoft.com for details)
> Seen the Entourage FAQ pages? - Check them out:
> <http://www.entourage.mvps.org/toc.html>
>
> Please post responses to this newsgroup. If I ask you to contact me
> off-list, remove '.INVALID' from email address before replying.