Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Member
    Join Date
    Nov 2001
    Posts
    56

    Default forward mail to file

    How can I have all new messages to a particular email address automatically saved to a file like /mail/testing.txt

    Is there a way to pipe it to a script that can write the file, for example? Thanks!

  2. #2
    Member
    Join Date
    Feb 2005
    Location
    North Carolina
    Posts
    237

    Default

    Not certain what the long-term objective is, but rather than worrying about a script, what not take a simpler route and create a new mail account (called archive, for example). Then create a forwarder so any mail addressed to the primary account also forwards to the "archive" mailbox.

  3. #3
    Member
    Join Date
    Jan 2005
    Posts
    1,880

    Default

    Quote Originally Posted by TechGuy
    How can I have all new messages to a particular email address automatically saved to a file like /mail/testing.txt

    Is there a way to pipe it to a script that can write the file, for example? Thanks!
    In short, yes.

    Email filters in cPanel can be set to pipe email to a script (Perl, PHP or whatever you fancy).

    Using PHP, the process of reading mail in from STDIN is really really straightforward and the process of then appending the email contents to a file is dead simple if you want to store absolutely everything. On the other hand, if you want to store only the body of emails, and in a human-readable format, you've got more of a challenge on your hands, but it's by no means impossible.

Similar Threads & Tags
Similar threads

  1. Replies: 0
    Last Post: 02-03-2011, 01:24 PM
  2. forward All recieved mail to a PHP file
    By nasser110 in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 09-15-2007, 04:10 PM
  3. Do you need a .procmailrc file and a .forward file?
    By simsong in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-22-2005, 04:38 AM
  4. .forward file???
    By noimad1 in forum cPanel and WHM Discussions
    Replies: 6
    Last Post: 04-29-2003, 02:42 PM
  5. .forward file with Exim?
    By jdatwood in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 06-13-2002, 06:35 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube