Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-12-2013, 11:24 PM   PM User | #1
ebsseattle
New to the CF scene

 
Join Date: Feb 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ebsseattle is an unknown quantity at this point
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.
ebsseattle is offline   Reply With Quote
Old 02-13-2013, 12:18 AM   PM User | #2
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,496
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.

Last edited by tangoforce; 02-13-2013 at 12:22 AM..
tangoforce is offline   Reply With Quote
Old 02-13-2013, 12:26 AM   PM User | #3
ebsseattle
New to the CF scene

 
Join Date: Feb 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
ebsseattle is an unknown quantity at this point
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).
ebsseattle is offline   Reply With Quote
Old 02-13-2013, 04:13 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,496
Thanks: 44
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
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!
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:02 AM.


Advertisement
Log in to turn off these ads.