Automator/applescript to forward junk mail as attachment...how?

I finally came up with a real use for Automator and Applescript -- I was delighted.
I want to modify my junk mail rule to run an Applescript that forwards a mail message as an attachment (not just a regular forward) to Spamcop.
It has to be forwarded as an attachment. First shot, I simply went to modify my junk mail rule but, alas, found that "forward as attachment" is not an option for Mail's rules. Fortunately, there is a "run Applescript" option so...
I fired up Automator, hoping to see how to tell Mail to forward a message as an attachment. Again, alas, no "as attachment" option there. So then I started exploring how to invoke the Mail menu item Message > Forward as Attachment but, haven't been able to figure it out.
Any help would be appreciated. Especially since this will be the first time I've actually found a use for Automator, which is great... I just know it's not merely eye candy...

Here is some starter code, to be saved into the current users' '~/Library/Scripts/Applications/Mail/' folder - as a script file ...
using terms from application "Mail"
on perform mail action with messages tMessages
repeat with i in tMessages -- Cycle throught the list of incoming 'Rule' filtered e-Mail messages.
-- File path file Name of temporary attachement file.
set file_Name to (((path to home folder from user domain) as string) & (do shell script "date +%Y%m%d%H%M%StempFile.txt"))
try -- Capture any unexpected AppleScript error.
set FREF to open for access file file_Name with write permission -- Create temporary attachement file.
write ((source of i) as string) to FREF starting at 0 -- Write to temporary attachement file.
close access FREF -- Close temporary attachement file.
-- Make new outgoing e-Mail message, and attach respective attachment file.
set tMessage to make new outgoing message with properties {visible:true, subject:"My Subject", content:("My Body" & return & return)}
tell content of tMessage
make new attachment with properties {file name:(file_Name as alias)} at after last paragraph
end tell
end try
try -- Capture any unexpected AppleScript error.
tell application "Finder" to delete file file_Name -- Trash temporary attachement file.
end try
end repeat
end perform mail action with messages
try -- Capture any unexpected AppleScript error.
tell application "Finder" to empty trash -- Delete all temporary attachement files (plus all other items) in the trash can.
end try
end using terms from

Similar Messages

  • I have emails that I can not delete from my Junk mail folder. How do I permanently delete them?

    I have emails that I can not delete from my Junk mail folder. How do I permanently delete them?

    Weird.
    Someone might stop by who has experienced/fixed/read about this before.  In the meantime...
    By "re-indexed my email" do you mean you rebuilt the mailbox via the "Rebuild" command in the Mailbox menu?  Did you try that for all the affected mailboxes?
    Also, you might try experimenting with the settings in Mail, Preferences, Accounts having to do with whether junk mail messages are stored on the server and whether they are to be deleted.
    Does this behavior persist when you are not connected to the internet?

  • Attachment disappear when forwarding a mail with attachment in a rule

    Could anyone verify my problem please?
    I have upgraded to Mountain Lion and Mail 6.1
    I have a rule set up in Mail to forward certain messages.
    However, since the upgrade, all messages being forwarded has all attachments striped.
    It appears that the problem occurs only when forward is being used by a rule.
    When I forward the same message manually, the attachment is sent as well.
    Am I missing something?
    Many thanks in advance.

    Update:
    Found the answer last night.
    Forward mail in a rule behaves differently since OS X Lion from previous versions.
    Forward mail set in a Rule would not forward any attachments in the original email.
    If forwarding with attachments is required, use redirect in the Rule instead. (However,
    you cannot append any message when using redirect)

  • I Cannot send or forward e-mail's. How do I fix this problem?

    Authentication required and the following message:
    "verify correct e-mail preferences"

    leprecaun28, I found the same fix in the community just a moment or two ago also. The poster was a BillJ. I tried the fix and it worked fine. Thanks.

  • Junk mail filter in yosemite doesn't work. i can't find the 'mark as junk' selection or 'remove from previous recipients' which would help to filter out spam.

    junk mail filter in yosemite doesn't work. from the flags, i can't find the 'mark as junk' selection. Formerly clicking on the email address in question would allow one to 'remove from previous recipients' which would help to filter out spam. I've adjusted all the settings under mail preferences, but that is not helping.

    Hello Diane162,
    Welcome to the Apple Support Communities!
    I understand that you would like to be able to filter some of the junk mail that you are receiving in Mail. The attached article has a lot of great information on junk mail filtering, including how to mark as junk and adjust the junk filter.
    Mail (Yosemite): Reduce junk mail in your inbox
    Cheers,
    Joe

  • Warning before emptying junk mail folder

    I am not sure if this option is disabled by default in the latest Thunderbird(31.4.0) but I used to get a warning popup asking if I am sure I want to empty the junk mail folder.
    How do I enable the popup warning before emptying junk mail folder.
    Thanks in advance.

    'Tools' > 'Options' > 'Advanced' > 'General' tab
    * click on 'Config Editor' button
    It will tell you to be careful :)
    * In top search type: junk
    * look for this line: mailnews.emptyJunk.dontAskAgain; Value = true
    * double click on that line to toggle the 'True' to 'False'
    * close window - top right X
    * Click on 'OK'

  • Junk Mail AppleScripts

    I've received email messages from others where my email address wasn't in their address book--so my message was defined as spam.
    The message asked me to call (no number, meaning I needed to know the recepient) to have my email address added to their address book.
    Is there an AppleScript that will automatically send this form email to every spam email I get...and then delete the spam email?
    I'm already forwarding it all to a Junk Mail folder, but it's starting to get absurd with hundreds of spam emails daily.

    Thanks for the response, but I've already set up a Junk Mail folder and have junk mail going into it.
    I don't want to deal with it any more, but I don't want to miss those few that slip through into Junk Mail that shouldn't because they have a new email or whatever.
    To be more specific, this is what I'd like to have happen:
    1. An incoming email message is catagorized as Junk through the Junk Mail filter.
    2. A form reply is generated that says, "I've been getting hundreds of spam emails lately, so I've had to bounce them back. If this message comes to you and you legitimately need to contact me, please call me to put your email address into my address book. Sorry for the inconvenience."
    3. The Junk message is deleted...not put into a Junk folder...deleted automatically.
    Is there an AppleScript that will do this for me?
    Thanks!
    Arlaine

  • When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    When I forward an email from my Mac Mail, the body of the email I just forwarded shows as an attachment in the recipients outlook.  Is there a way to change this so my clients don't have to open an attachment to read something that I forwarded to them?

    Open Terminal in Utilties and copy/paste
    This will send the attachment embedded inline. (This works in Snow Leopard, but not sure about Lion. Do a test first. If it doesn't work, just google "send attachment embedded + Lion." You don't actually have to send the message to see how it will appear.)
    defaults write com.apple.mail DisableInlineAttachmentViewing 0
    To reverse the setting, change the 0 to a 1
    However, whether this will work or not will depend on what the e-mail client on the receiver's end does with it.

  • Script for forward mail as attachment

    Hi,
    I think there is no direct call for creating forward mail as attachment. I tried "forward" reply and other things.Its working fine.
    Please let me know if any one have idea for creating script for apple mail "forward as attachment".

    hm... perhaps these two functions do what you wanna do :-/
    on createmail_emlx_files_attachment_ofselection()
    tell application "Mail"
    -- get the mail selection
    set myMessages to selection
    --do it to every selected mail
    repeat with m in myMessages
    --get the folder where the emlx file is stored in
    set mypath to quoted form of POSIX path of ((account directory of account of mailbox of m) as alias)
    --get the id of that message (should be unique within each account)
    set myid to id of m
    --find the folder where this unique email (by id) is stored in
    set myfolder to quoted form of (paragraph 1 of (do shell script "find " & mypath & " -name '" & myid & ".emlx' -exec dirname {} \\;"))
    --create a compressed tar archive of this message and open this gzipped files with Apple Mail (-> attach it to a new message).
    do shell script "cd " & myfolder & ";tar -rf " & myid & ".tar " & myid & ".emlx;gzip " & myid & ".tar;mv " & myid & ".tar.gz /tmp/;open -a /Applications/Mail.app /tmp/" & myid & ".tar.gz"
    end repeat
    end tell
    end createmail_emlx_files_attachment_ofselection
    on createmail_source_attachment_ofselection()
    tell application "Mail"
    -- get the mail selection
    set myMessages to selection
    --do it to every selected mail
    repeat with m in myMessages
    set myid to id of m
    set mysource to quoted form of ((source of m) as text)
    do shell script "cd /tmp/;echo " & mysource & "|cat>/tmp/" & myid & ".txt;gzip " & myid & ".txt;open -a /Applications/Mail.app " & myid & ".txt.gz"
    end repeat
    end tell
    end createmail_source_attachment_ofselection

  • Help forwarded e-mail comes up as mime-attachements can't read the forward!

    Help, I recieve forwarded e-mail from friends with content that comes up as a mime-attachment in iPhone's mail app. Is there a setting I can change to make the forwarded e-mail appear. It works under the Mac OS X mail app and looks fine. The forwarded e-mail are either text, url or photos. My Fiancé laughed at me and said I thought your $expensive$ phone can get e-mail. I'm using .mac and yahoo mail accounts.

    Serves you right for getting a girlie phone... (joking)
    Can you send yourself a message from your PC to test if it works? I have read several posts about the iPhone mail client having problems with certain types of encoding (like from AOL). If you can send youself a pic from your .mac account and have it work fine, then perhaps you can eliminate one variable - if all your emails from everywhere look bad, then you have another problem.

  • Use AppleScript or Automator (or both) to get Mail and add to a text file?

    Hello all,
    I'm sorry if this is a duplicate of a well-known topic, I tried searching and couldn't see anything.
    I'm behind a proxy at work that blocks any kind of webmail access, but I'd like to be able to check my email while on a break or something.
    I had the idea that I could use Automator or Applescript to check my mail, get the new messages and add the text to a textfile that I could host on my personal webserver that I use for family stuff.
    I've tried an automator workflow that seems to work while in Automator, but when I save it as an application, it won't even start Mail to check.
    I also thought of just leaving mail running, and have a rule that starts a script when new mail arrives, but I don't know enough about Applescript to do it.
    I don't want to confuse anyone with the details of my convoluted ideas, so I'll leave it at that.
    Is there a way to do this? I want mail to check the server, download the messages, new messages get their text appended to a text file that's stored in my webserver's directory (same computer) that I can access from the web, and have it repeat every 5 minutes or so.
    If I've left out a detail, let me know, and if I'm just stupid and there's an easy way to do this... be kind.
    Thanks!
    aeix
    iMac G5 2.0 GHz   Mac OS X (10.4.6)  

    It certainly is going in the right direction. I'm not all that versed in AppleScript, but it looks like that particular script is creating a new text file for every message processed.
    I would like to either create a specific text file if it doesn't exist, or append the text to the end of the file if it does exist.
    But like I said, definitely heading in the right direction!
    iMac G5 2.0 GHz Mac OS X (10.4.6)

  • Hardly any junk mail - mail is forwarded from Yahoo

    I decided to start using .Mac mail today. I've been using Yahoo as my account. For now I'm keeping my same email address so I set Yahoo to forward all mail to my .Mac account.
    I usually get 100+ junk messages a day. For most of today, I've only gotten a couple and those are nothing like the crazy type of junk emails I get.
    I have the preferences to not keep the Junk on the server, so in the Junk mail showing up on the computer is just a couple.
    I'm assuming the Yahoo is forwarding all the junk but where they heck are they.
    Only care so that I can view to check when messages are improperly marked as junk AND I wonder if there are other emails that are not getting to me.

    Hello, again -
    After reading discussions about a similar topic, I figured out how to fix the problem.  Somehow, the .mbox suffix had been removed from the Home>Library>Mail>junk folder.
    I added the suffix, and now it works.  Where it went in the first place, I don't know.

  • James Send to Junk Mail

    Hello , i am using james 2.2.0 installed on a server with a online DNS , it recives mails properly , but when i try to send emails ( also when using Authenticated SMTP) , mail go to junk mails ( as hotmail and yahoo) , When i use Outlook express outside the server to send mail i get the following error :
    The message could not be sent because one of the recipients was rejected by the server. The rejected e-mail address was '[email protected]'. Subject 'hahahhaha', Account: 'mytrans-port.com', Server: 'mytrans-port.com', Protocol: SMTP, Server Response: '550 - Requested action not taken: relaying denied', Port: 25, Secure(SSL): No, Server Error: 550, Error Number: 0x800CCC79
    here is my config.xml , Thanks
    <?xml version="1.0"?>
    <!DOCTYPE config [
    <!ENTITY listserverConfig SYSTEM "../conf/james-listmanager.xml">
    <!ENTITY listserverStores SYSTEM "../conf/james-liststores.xml">
    <!ENTITY fetchmailConfig SYSTEM "../conf/james-fetchmail.xml">
    ]>
    <!--  Configuration file for the ASF James server -->
    <!--  This file contains important settings that control the behaviour -->
    <!--  of all of the services and repositories. -->
    <!--                               README!                            -->
    <!-- This configuration file is designed to run without alteration for simple tests. -->
    <!-- It assumes you have a DNS server on localhost and assigns a root password of root. -->
    <!-- In case the defaults do not suit you, the items you are most likely to need to change -->
    <!-- are preceded by a CHECKME! or CONFIRM? comment in the left margin. -->
    <!-- For production use you will probably need to make more extensive changes, see -->
    <!-- http://james.apache.org/documentation_2_1.html -->
    <!-- $Revision: 1.40.2.26 $ Committed on $Date: 2004/06/16 02:42:08 $ by: $Author: noel $ -->
    <config>
       <James>
    <!-- CHECKME! -->
          <!-- This is the postmaster email address for this mail server. -->
          <!-- Set this to the appropriate email address for error reports -->
          <!-- If this is set to a non-local email address, the mail server -->
          <!-- will still function, but will generate a warning on startup. -->
          <postmaster>Postmaster@localhost</postmaster>
          <!-- servernames identifies the DNS namespace served by this instance of James. -->
          <!-- These servernames are used for both matcher/mailet processing and SMTP auth -->
          <!-- to determine when a mail is intended for local delivery. -->
          <!-- -->
          <!-- If autodetect is TRUE, James wil attempt to discover its own host name AND -->
          <!-- use any explicitly specified servernames. -->
          <!-- If autodetect is FALSE, James will use only the specified servernames. -->
          <!-- -->
          <!-- If autodetectIP is not FALSE, James will also allow add the IP address for each servername. -->
          <!-- The automatic IP detection is to support RFC 2821, Sec 4.1.3, address literals. -->
          <!-- -->
          <!-- To override autodetected server names simply add explicit servername elements. -->
          <!-- In most cases this will be necessary. -->
          <!-- By default, the servername 'localhost' is specified. This can be removed, if required. -->
          <!-- -->
          <!-- Warning: If you are using fetchpop it is important to include the -->
          <!-- fetched domains in the server name list to prevent looping.       -->
          <servernames autodetect="true" autodetectIP="true">
    <!-- CONFIRM? -->
             <servername>mytrans-port.com</servername>
          </servernames>
          <!-- Set whether user names are case sensitive or case insensitive -->
          <!-- Set whether to enable local aliases -->
          <!-- Set whether to enable forwarding -->
          <usernames ignoreCase="true" enableAliases="true" enableForwarding="true"/>
          <!-- The inbox repository is the location for users inboxes -->
          <!-- Default setting: file based repository - enter path ( use  "file:///" for absolute) -->
          <inboxRepository>
             <repository destinationURL="file://var/mail/inboxes/" type="MAIL"/>
          </inboxRepository>
          <!-- Alternative inbox repository definition for DB use. -->
          <!-- The format for the destinationURL is "db://<data-source>/<table>" -->
          <!-- <data-source> is the datasource name set up in the database-connections block, below -->
          <!-- <table> is the name of the table to store user inboxes in -->
          <!-- The user name is used as <repositoryName> for this repository config. -->
          <!--
          <inboxRepository>
             <repository destinationURL="db://maildb/inbox/" type="MAIL"/>
          </inboxRepository>
          -->
          <!-- Alternative inbox repository definition for DB use. -->
          <!-- Stores message body in file system, rest in database -->
          <!--
          <inboxRepository>
             <repository destinationURL="dbfile://maildb/inbox/" type="MAIL"/>
          </inboxRepository>
          -->
          <!-- Alternative inbox repository definition for mbox use. -->
          <!-- This method uses UNIX standard mbox files and is meant for people using mbox files -->
          <!-- with systems such as mail list archive displayers -->
          <!-- Note that dot-locking is not currently supported -->
          <!-- so network (write) accesses may cause mbox corruption -->
          <!-- the sample mbox URL is an absolute URL; mbox:///var/mail will put the users mbox files in /var/mail/-->
          <!--
          <inboxRepository>
             <repository destinationURL="mbox:///var/mail/" type="MAIL"/>
          </inboxRepository>
          -->
       </James>
       <!-- Fetch pop block, fetches mail from POP3 servers and inserts it into the incoming spool -->
       <!-- Warning: It is important to prevent mail from looping by setting the  -->
       <!-- fetched domains in the <servernames> section of the <James> block     -->
       <!-- above. This block is disabled by default.                             -->
       <!-- FetchPOP is being deprecated in favor of FetchMail                    -->
        <fetchpop enabled="true">
            <!-- You can have as many fetch tasks as you want, but each must have a -->
            <!-- unique name by which it identified -->
            <fetch name="mydomain.com">
                <!-- Host name or IP address -->
                <host>mail.mydomain.com</host>
                <!-- Account login username -->
                <user>username</user>
                <!-- Account login password -->
                <password>pass</password>
                <!-- How frequently this account is checked - in milliseconds. 600000 is every ten minutes -->
                <interval>600000</interval>
            </fetch>
        </fetchpop>
        <!-- This is an example configuration for FetchMail, a JavaMail based gateway  -->
        <!-- service that pulls messages from other sources, and inserts them into the -->
        <!-- spool.  They are then processed normally, although FetchMail generally    -->
        <!-- has to fabricate some of the envelope information.  FetchMail should be   -->
        <!-- considered a mail gateway, rather than a relay, in RFC terms.             -->
        <!-- Fetchmail is a functionally richer replacement for FetchPOP.              -->
        <!-- CHECKME: FetchMail is disabled by default, and must be configured to use. -->
        <!-- Edit the file referred to by fetchmailConfig to enable and configure.     -->
        &fetchmailConfig;
       <!-- The James Spool Manager block  -->
       <!-- -->
       <!-- This block is responsible for processing messages on the spool. -->
       <spoolmanager>
          <!-- Number of spool threads -->
          <threads> 10 </threads>
          <!-- Set the Java packages from which to load mailets and matchers -->
          <mailetpackages>
             <mailetpackage>org.apache.james.transport.mailets</mailetpackage>
          </mailetpackages>
          <matcherpackages>
             <matcherpackage>org.apache.james.transport.matchers</matcherpackage>
          </matcherpackages>
          <!-- The root processor is a required processor - James routes all mail on the spool -->
          <!-- through this processor first. -->
          <!-- -->
          <!-- This configuration is a sample configuration for the root processor. -->
          <processor name="root">
             <!-- Checks that the email Sender is associated with a valid domain. -->
             <!-- Useful for detecting and eliminating spam. -->
             <!-- For this block to function, the spam processor must be configured. -->
             <!--
             <mailet match="SenderInFakeDomain=64.55.105.9,64.94.110.11,194.205.62.122,194.205.62.62,195.7.77.20,206.253.214.102,212.181.91.6,219.88.106.80,194.205.62.42,216.35.187.246,203.119.4.6" class="ToProcessor">
                <processor> spam </processor>
             </mailet>
             -->
             <!-- Important check to avoid looping -->
             <mailet match="RelayLimit=30" class="Null"/>
             <!--
             <mailet match="All" class="XMLVirtualUserTable">
                <!- 1:1 mapping ->
                <mapping>morgoth@middle-earth=sauron@mordor</mapping>
                <!- 1:n mapping ->
                <mapping>istari@middle-earth=saruman@isengard;radigast;gandalf</mapping>
                <!- DSN mapping ->
                <mapping>boromir@osgilliath=error:550 Requested action not taken: no such user here</mapping>
                <!- regex based mapping ->
                <mapping>*@osgilliath=regex:(.*)@osgilliath:${1}@minas-tirith</mapping>
                <!- both standard and regex mapping ->
                <mapping>ring@*=onering@mordor;regex:ring@(.*):ring@${1}</mapping>
                <!- conditional regex mapping example ->
                <mapping>*@listserver=regex:(.*)-on@listserver:${1}-subscribe@listserver;
                                      regex:(.*)-off@listserver:${1}-unsubscribe@listserver
                </mapping>
             </mailet>
             -->
             <!-- White List:
                  If you use block lists, you will probably want to check
                  for known permitted senders.  This is particularly true
                  if you use more aggressive block lists, such as SPEWS,
                  that are prone to block entire subnets without regard
                  for non-spamming senders.
              -->
             <!-- specific known senders -->
             <!--
             <mailet match="SenderIs=goodboy@goodhost"
                     class="ToProcessor">
                <processor> transport </processor>
             </mailet>
             -->
             <!-- People on this list agree to pay a penalty if they send spam -->
             <mailet match="InSpammerBlacklist=query.bondedsender.org"
                     class="ToProcessor">
               <processor> transport </processor>
             </mailet>
             <!-- E-mail legally required not to be spam (see: http://www.habeas.com) -->
             <!--
             <mailet match="HasHabeasWarrantMark" class="ToProcessor">
                <processor> transport </processor>
             </mailet>
             -->
             <!-- End of White List -->
             <!-- Check for delivery from a known spam server -->
             <!-- This set of matchers/mailets redirect all emails from known -->
             <!-- black holes, open relays, and spam servers to the spam processor -->
             <!-- For this set to function properly, the spam processor must be configured. -->
             <mailet match="InSpammerBlacklist=dnsbl.njabl.org"
                     class="ToProcessor">
               <processor> spam </processor>
               <notice>550 Requested action not taken: rejected - see http://njabl.org/ </notice>
             </mailet>
             <mailet match="InSpammerBlacklist=relays.ordb.org"
                     class="ToProcessor">
               <processor> spam </processor>
               <notice>550 Requested action not taken: rejected - see http://www.ordb.org/ </notice>
             </mailet>
             <!-- Sample matching to kill a message (send to Null) -->
             <!--
             <mailet match="RecipientIs=badboy@badhost" class="Null"/>
             -->
             <!-- Send remaining mails to the transport processor for either local or remote delivery -->
             <mailet match="All" class="ToProcessor">
                <processor> transport </processor>
             </mailet>
          </processor>
          <!-- The error processor is required.  James may internally set emails to the -->
          <!-- error state.  The error processor is generally invoked when there is an -->
          <!-- unexpected error either in the mailet chain or internal to James. -->
          <!-- -->
          <!-- By default configuration all email that generates an error in placed in -->
          <!-- an error repository. -->
          <processor name="error">
             <!-- If you want to notify the sender their message generated an error, uncomment this       -->
             <!--
             <mailet match="All" class="Bounce"/>
             -->
             <!-- If you want to notify the postmaster that a message generated an error, uncomment this  -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <!-- Logs any messages to the repository specified -->
             <mailet match="All" class="ToRepository">
                <repositoryPath> file://var/mail/error/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/error </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- Processor CONFIGURATION SAMPLE: transport is a sample custom processor for local or -->
          <!-- remote delivery -->
          <processor name="transport">
            <!-- This is an example configuration including configuration for a list server. -->
            <!-- CHECKME: before uncommenting this, edit the configuration file's contents   -->
            <!--
              &listserverConfig;
            -->
             <!-- Is the recipient is for a local account, deliver it locally -->
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
             <!-- If the host is handled by this server and it did not get -->
             <!-- locally delivered, this is an invalid recipient -->
             <mailet match="HostIsLocal" class="ToProcessor">
                <processor> local-address-error </processor>
                <notice>550 - Requested action not taken: no such user here</notice>
             </mailet>
    <!-- CHECKME! -->
             <!-- This is an anti-relay matcher/mailet combination -->
             <!-- -->
             <!-- Emails sent from servers not in the network list are  -->
             <!-- rejected as spam.  This is one method of preventing your -->
             <!-- server from being used as an open relay.  Make sure you understand -->
             <!-- how to prevent your server from becoming an open relay before -->
             <!-- changing this configuration. See also <authorizedAddresses> in SMTP Server -->
             <!-- -->
             <!-- This matcher/mailet combination must come after local delivery has -->
             <!-- been performed.  Otherwise local users will not be able to receive -->
             <!-- email from senders not in this remote address list. -->
             <!-- -->
             <!-- If you are using this matcher/mailet you will probably want to -->
             <!-- update the configuration to include your own network/addresses.  The -->
             <!-- matcher can be configured with a comma separated list of IP addresses  -->
             <!-- wildcarded IP subnets, and wildcarded hostname subnets. -->
             <!-- e.g. "RemoteAddrNotInNetwork=127.0.0.1, abc.de.*, 192.168.0.*" -->
             <!-- -->
             <!-- If you are using SMTP authentication then you can (and generally -->
             <!-- should) disable this matcher/mailet pair. -->
             <mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
                <processor> relay-denied </processor>
                <notice>550 - Requested action not taken: relaying denied</notice>
             </mailet>
             <!-- Attempt remote delivery using the specified repository for the spool, -->
             <!-- using delay time to retry delivery and the maximum number of retries -->
             <mailet match="All" class="RemoteDelivery">
                <outgoing> file://var/mail/outgoing/ </outgoing>
                <!-- alternative database repository example below -->
                <!--
                <outgoing> db://maildb/spool/outgoing </outgoing>
                -->
                <!-- Delivery Schedule based upon RFC 2821, 4.5.4.1 -->
                <!-- 5 day retry period, with 4 attempts in the first
                     hour, two more within the first 6 hours, and then
                     every 6 hours for the rest of the period. -->
                <delayTime>  5 minutes </delayTime>
                <delayTime> 10 minutes </delayTime>
                <delayTime> 45 minutes </delayTime>
                <delayTime>  2 hours </delayTime>
                <delayTime>  3 hours </delayTime>
                <delayTime>  6 hours </delayTime>
                <maxRetries> 25 </maxRetries>
                <!-- The number of threads that should be trying to deliver outgoing messages -->
                <deliveryThreads> 1 </deliveryThreads>
                <!-- If false the message will not be sent to given server if any recipients fail -->
                <sendpartial>false</sendpartial>
                <!-- A single mail server to deliver all outgoing messages. -->
                <!-- This is useful if this server is a backup or failover machine, -->
                <!-- or if you want all messages to be routed through a particular mail server, -->
                <!-- regardless of the email addresses specified in the message -->
                <!-- -->
                <!-- The gateway element specifies the gateway SMTP server name. -->
                <!-- If your gateway mail server is listening on a port other than 25, -->
                <!-- you can set James to connect to it on that port using the gatewayPort -->
                <!-- element. -->
                <!-- Although normally multiple addresses are implemented through proper -->
                <!-- DNS configuration, the RemoteDelivery mail does allow specifying -->
                <!-- multiple gateway elements, each of which may also have a port -->
                <!-- e.g., mygateway:2525 -->
                <!-- the gatewayPort element is used as a default -->
                <!--
                <gateway> mytrans-port.com</gateway>
                <gatewayPort>25</gatewayPort>
                -->
             </mailet>
          </processor>
          <!-- Processor CONFIGURATION SAMPLE: spam is a sample custom processor for handling -->
          <!-- spam. -->
          <!-- You can either log these, bounce these, or just ignore them. -->
          <processor name="spam">
             <!-- To destroy all messages, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="Null"/>
             -->
             <!-- To notify the sender their message was marked as spam, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="Bounce"/>
             -->
             <!-- To notify the postmaster that a message was marked as spam, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <!-- To log the message to a repository, this matcher/mailet configuration should be uncommented. -->
             <!-- This is the default configuration. -->
             <mailet match="All" class="ToRepository">
                <repositoryPath>file://var/mail/spam/</repositoryPath>
                <!-- Changing the repositoryPath, as in this commented out example, will -->
                <!-- cause the mails to be stored in a database repository.  -->
                <!-- Please note that only one repositoryPath element can be present for the mailet -->
                <!-- configuration. -->
                <!--
                <repositoryPath> db://maildb/deadletter/spam </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- This processor handles messages that are for local domains, where the user is unknown -->
          <processor name="local-address-error">
             <!-- To notify the sender the address was invalid, uncomment this matcher/mailet configuration -->
             <!-- The original message is not attached to keep the bounce processor from deliverying spam -->
             <!--
             <mailet match="All" class="Bounce">
                <attachment>none</attachment>
             </mailet>
             -->
             <!-- To notify the postmaster that a message had an invalid address, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <mailet match="All" class="ToRepository">
                <repositoryPath> file://var/mail/address-error/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/address-error </repositoryPath>
                -->
             </mailet>
          </processor>
          <!-- This processor handles messages that are for foreign domains, where relaying is denied -->
          <!-- As of James v2.2, this processor can be deprecated by using the <authorizedAddresses> tag
               in the SMTP Server, and rejecting the message in the protocol transaction.  -->
          <processor name="relay-denied">
             <!-- To notify the sender the address was invalid, uncomment this matcher/mailet configuration -->
             <!-- The original message is not attached to keep the bounce processor from deliverying spam -->
             <!--
             <mailet match="All" class="Bounce">
                <attachment>none</attachment>
             </mailet>
             -->
             <!-- To notify the postmaster that a relay request was denied, uncomment this matcher/mailet configuration -->
             <!--
             <mailet match="All" class="NotifyPostmaster"/>
             -->
             <mailet match="All" class="ToRepository">
                <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
                <!-- An alternative database repository example follows. -->
                <!--
                <repositoryPath> db://maildb/deadletter/relay-denied </repositoryPath>
                -->
             </mailet>
          </processor>
       </spoolmanager>
       <!-- DNS Server Block -->
       <!-- -->
       <!-- Specifies DNS Server information for use by various components inside -->
       <!-- James. -->
       <!-- -->
       <!-- If autodiscover is true, James will attempt to autodiscover the DNS servers configured on your underlying system.-->
       <!-- Currently, this works if the OS has a unix-like /etc/resolv.conf,-->
       <!-- or the system is Windows based with ipconfig or winipcfg.-->
       <!-- -->
       <!-- If no DNS servers are found and you have not specified any below, 127.0.0.1 will be used-->
       <!-- If you use autodiscover and add DNS servers manually a combination of all the dns servers will be used  -->
       <!--  -->
       <!-- Information includes a list of DNS Servers to be used by James.  These are -->
       <!-- specified by the server elements, each of which is a child element of the -->
       <!-- servers element.  Each server element is the IP address of a single DNS server. -->
       <!-- The servers element can have multiple server children. -->
       <dnsserver>
          <servers>
             <!--Enter ip address of your DNS server, one IP address per server -->
             <!-- element. -->
             <!--
              <server>216.251.32.100</server>
             -->
          </servers>
          <!-- Change autodiscover to false if you would like to turn off autodiscovery -->
          <!-- and set the DNS servers manually in the <servers> section -->
          <autodiscover>true</autodiscover>
          <authoritative>false</authoritative>
       </dnsserver>
       <remotemanager>
          <port>4555</port>
          <!--  Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!--  Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the RemoteManager -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <administrator_accounts>
    <!-- CHECKME! -->
                <!-- Change the default login/password. -->
                <account login="username" password="password"/>
             </administrator_accounts>
             <connectiontimeout> 60000 </connectiontimeout>
          </handler>
       </remotemanager>
        <!-- The POP3 server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
       <pop3server enabled="true">
          <!-- port 995 is the well-known/IANA registered port for POP3S  ie over SSL/TLS -->
          <!-- port 110 is the well-known/IANA registered port for Standard POP3 -->
          <port>110</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!--  Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the POP3 -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <connectiontimeout>120000</connectiontimeout>
          </handler>
       </pop3server>
        <!-- The SMTP server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
       <smtpserver enabled="true">
          <!-- port 25 is the well-known/IANA registered port for SMTP -->
          <port>25</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!-- Uncomment this if you want to use TLS (SSL) on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the SMTP -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <connectiontimeout>360000</connectiontimeout>
             <!--  Uncomment this if you want to require SMTP authentication. -->
             <!--
             <authRequired>true</authRequired>
             -->
    <!-- CHECKME! -->
             <!--  Uncomment this if you want to authorize specific addresses/networks.
                   If you use SMTP AUTH, addresses that match those specified here will
                   be permitted to relay without SMTP AUTH.  If you do not use SMTP
                   AUTH, and you specify addreses here, then only addresses that match
                   those specified will be permitted to relay.
                   Addresses may be specified as a an IP address or domain name, with an
                   optional netmask, e.g.,
                   127.*, 127.0.0.0/8, 127.0.0.0/255.0.0.0, and localhost/8 are all the same
                   See also the RemoteAddrNotInNetwork matcher in the transport processor.
                   You would generally use one OR the other approach.
             -->
             <authorizedAddresses>127.0.0.0/8</authorizedAddresses>
             <!--  Uncomment this if you want to verify sender addresses, ensuring that -->
             <!--  the sender address matches the user who has authenticated. -->
             <!--  This prevents a user of your mail server from acting as someone else -->
             <!--
             <verifyIdentity>true</verifyIdentity>
             -->
             <!--  This sets the maximum allowed message size (in kilobytes) for this -->
             <!--  SMTP service. If unspecified, the value defaults to 0, which means no limit. -->
             <maxmessagesize>0</maxmessagesize>
          </handler>
       </smtpserver>
        <!-- The NNTP server is enabled by default -->
        <!-- Disabling blocks will stop them from listening, -->
        <!-- but does not free as many resources as removing them would -->
        <!-- NNTP-specific: if you disable the NNTP Server, you should also set the nntp-repository's
             threadCount to 0, otherwise there will be threads active and polling  -->
       <nntpserver enabled="true">
       <!-- THE NNTP PROTOCOL IS EXPERIMENTAL AND NOT AS WELL TESTED AS SMTP AND POP3 IN THIS RELEASE.
            The James project recommends that you check the James web site for updates to the NNTP
            service.  -->
          <!-- port 563 is the well-known/IANA registered port for NNTP over SSL/TLS -->
          <!-- port 119 is the well-known/IANA registered port for Standard NNTP -->
          <port>119</port>
          <!-- Uncomment this if you want to bind to a specific inetaddress -->
          <!--
          <bind> </bind>
          -->
          <!-- Uncomment this if you want to use TLS (SSL)  on this port -->
          <!--
          <useTLS>true</useTLS>
          -->
          <handler>
             <!-- This is the name used by the server to identify itself in the NNTP -->
             <!-- protocol.  If autodetect is TRUE, the server will discover its -->
             <!-- own host name and use that in the protocol.  If discovery fails, -->
             <!-- the value of 'localhost' is used.  If autodetect is FALSE, James -->
             <!-- will use the specified value. -->
             <helloName autodetect="true">myMailServer</helloName>
             <co                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    hi
    you have to change the config.xml to allow the server accept relay mails from your host machine from which you are sendign the mail ...
    ie
    change
    <mailet match="RemoteAddrNotInNetwork=127.0.0.1" class="ToProcessor">
    <processor> relay-denied </processor>
    <notice>550 - Requested action not taken: relaying denied</notice>
    </mailet>
    add few more ips (your network / subnet ip)
    so that it accpets mails from that machine to be relayed ...
    you can also change the smtp autheriZation part and do that ...
    any one is enough ..
    Regards
    Venkat

  • Stopping Junk Mail once and for all.

    Hi everyone!
    Like most everyone I think that spam is rather annoying. I was thinking about how to get rid of it and came up with a very simple yet powerful idea. I've never heard of this way so at least in my own little world I can say I came up with it.
    The idea is this: You define a basic set of mail rules. The rules would be this:
    - If ALL of the following conditions are met:
    + Sender is not in my Address Book
    + Sender is not in my Previous Recipients
    + Message is Junk Mail
    Now of course using the rules that were set above are not at all a great way of defining spam, because someone trying to get a hold of you (such as a potential employer or long lost friend for example) will likely not make their way through those rules, and their message will be marked as spam. Here's where it gets good though! Instead of simply doing a message bounce, you can also add a custom message that goes along with the bounce, as if you were to reply to the spam yourself. Now of course you can make some dirty comments to the potential spammer, but the point of the auto replying is not to be mean or anything of the like. So before going further, here's what would basically happen:
    -=-=-=-
    I have automatically returned this message to you because I think it is spam.
    Original message:
    Is your girlfriend happy?!?! bla bla bla
    -=-=-=-
    Okay now back to the problem: what if the supposed spam message is actually not spam and is important? Well, not a problem! We now use the power of the custom response. Instead of just saying "I have automatically returned this message to you because I think it is spam," we can also add "If this message is not spam, please resend the message and include in the subject line the phrase "we2y9e5". So if the message was indeed a legitimate email and not spam, the original sender can now put the phrase "we2y9e5" in the subject field. And now that can be a custom mail rule! So in the end you'll have:
    - If ALL of the following conditions are met:
    + Sender is not in my Address Book
    + Sender is not in my Previous Recipients
    + Subject does not contain we2y9e5
    Perform the following actions:
    + Reply to Message [Reply Message Text...]
    + Delete Message
    So now if the Sender sends you an email with the subject "we2y9e5" in it, it will no longer be bounced back to them. From there you can add the Sender to your Address Book and have a new lifelong friend.
    Of course, if the message was actual spam, the spammer could just go ahead and put "we2y9e5" in the subject line and get through your new shield. This is in no way a problem though, because if people start using this method there's no way a spammer would bother looking for the phrase in an email. Even if they did, it's just a simple matter of changing your phrase and updating the rule that goes along with that phrase. You can even have a little fun and make it like a little puzzle, like "the phrase is the sound a cat makes" or something like that. Just don't make it too confusing, but you get the idea.
    No spam means it's far less likely for users to have their computer taken over by those who are up to no good. You won't have to nervously post your email on forums in some weird "this-is[delete this section]my-email [at] yahoo [d0t] com" format. Best of all you'll never have to go through your mail and delete spam again! Give this method a try and I think you'll be pleasantly surprised.
    I have attached some screenshots of how to set it up for those who are like me and would rather go off a picture.
    Happy emailing!
    http://www.fullarticulation.net/tutorials/spam/antispam01.jpg
    http://www.fullarticulation.net/tutorials/spam/antispam02.jpg
    http://www.fullarticulation.net/tutorials/spam/antispam03.jpg
    ~Reckless Ronin
    [email protected]
    www.fullarticulation.net

    There are a number of problems with this approach.
    1. You should not reply to spam, since in the unlikely event that the "reply to" or "return path" email address is actually owned by spammers, it will confirm to them that yours is a real, "live" email address. This will get it on lists sold & traded among spammers, increasing dramatically the number of junk messages sent to you.
    Note: bouncing spam will usually have the same effect, since (contrary to what you might think) it is easy to extract the "bouncer's" email address from the message Mail sends. Bouncing is really only effective if a human reads the reply.
    2. In the more typical case, the sender's address is forged, often with a real address of some entity, perhaps from one of these "known good" lists. Sometimes a real address is chosen specifically to victimize its owner, for instance to damage a reputation or to flood a mailbox -- sometimes this is the entire purpose of the spam.
    3. A lot of legitimate email is generated by automated systems with no human involved. Frequently these are alerts or advisories, telling you that if action is required it must be done by other than email means, such as through a web site or phone call. Some ignore all email replies, or take action only on those with specific subject or body keywords. It is often not possible to know in advance the email address this type of message is sent from; thus, you can not add it to Address Book until you actually receive an example.
    4. Even if the sender is a human & the message is legitimate, the "I think this is spam" reply may cause them not to resend a second version containing your special keyword for various reasons. Imagine for instance someone on a slow, dial up connection, or on a usage based fee service, or with any sort of quota limits to worry about. Or think about what would be required if some poor soul sent a first-time message to a large group, say for organizing a high school reunion, & many of them used this approach, each with their own special 'not junk' keyword.
    Basically, a good, effective junk filter must not generate a large number of false positives, & it certainly should not make things easier for spammers or harder for other users. I urge you to rethink this approach.

  • Automator/Applescript action to redirect selected messages individually?

    I have been studying Automator to see if I could create a workflow that takes all currently selected messages and sends them one by one to a fixed e-mail address. I want to use this to select junk mail and send them to the junk mail trainer address. Nothing more than for each message a Cmd-E, type-junk-mail-trainer-address, Cmd-D.
    I haven't been able to find out (I spent maybe one to two hours on this) to get even one thing working. Now, before I go in deep and try to learn AppleScript, is there may be some beast already out there?
    Thanks,
    G

    After having looked on the internet (Google, mainly and clicking through) I have concluded that as far as people have tried this they have failed because Mail's redirect AppleScript command is broken (at least until 10.4.6). Discussions go on at depth regarding debugging this broken stuff.
    I have also not found any usable script.
    So, my conclusion is that this very handy tool that would work fine with Mac OS X Server's junkmail/notjunkmail trainer addresses for spam is currently not possible. Maybe something for Apple to provide in mail (train/untrain mail server command)

Maybe you are looking for