Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script to forward email, only change Subject line

    My PHP skills are very limited, so I wanted to ask here. Can anyone point me in the right direction to a PHP script which I can use that will forward emails as-is, but just add the original recipient's email address as part of the subject line?

    For example:
    An email is sent from sender@sender.com to recipient@recipient.com (me), with the Subject line "This is the subject".
    I want my recipient@recipient.com email to automatically forward the message (and any attachments) to my other email myaddress@myaddress.com but change the subject line to read: "[recipient@recipient.com fwd] This is the subject".

    Thanks for any help anyone can provide.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,441
    Thanks
    62
    Thanked 537 Times in 524 Posts
    To be honest, there isn't going to be a script that does exactly that out there.

    You also don't seem to understand what this involves either. On any system it isn't just a case of "a script", it's also a case of system configuration. On linux you must setup piping (which you need permission to do - not many sites offer this) and on windows you would need a customised mail server.

    PHP is not a mail server. Sure, you could run a SMTP daemon but PHP isn't the best choice for this and even then if you have permission to run a daemon you're better off using piping or a customised smtp service. I am currently working on one myself but its not finished. It won't process mail but will upload it via a http post request to the script url of your choice. Your script can then process it and do whatever. It's not ready for use yet really but if you PM me a reminder in a month I could probably rush a very early version out the door for you to use. You'd need to be able to install it on a 24/7 windows machine though.

    Sorry it's not better news,

    tango
    Last edited by tangoforce; 02-13-2013 at 01:22 AM.
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!

  • #3
    New to the CF scene
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, that's what I meant. I've followed a tutorial on phpacademy.org on setting up a pipe using cPanel, but the only part I want to configure is the php file that parses the emails. However, I'm still unclear on whether this will maintain all of the elements of the original email or not (font, links, etc).

  • #4
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,441
    Thanks
    62
    Thanked 537 Times in 524 Posts
    I've only ever used piping once and you literally have to process the entire email yourself - it comes through as lines of text so be sure you know your regular expressions!
    See my new CodingForums Blog: http://www.codingforums.com/blogs/tangoforce/

    Many useful explanations and tips including: Cannot modify headers - already sent, The IE if (isset($_POST['submit'])) bug explained, unexpected T_CONSTANT_ENCAPSED_STRING, debugging tips and much more!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •