shane18 Posted January 21, 2010 Share Posted January 21, 2010 Is there any way where I can insert a header into a e-mail that is sent to a mobile phone, so that when they reply back my script can read the header to get a session id so I know where the reply must be redirected to? Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/ Share on other sites More sharing options...
gizmola Posted January 21, 2010 Share Posted January 21, 2010 You're all over the place with that idea. PHP sessions are for browsing/http. If you want to put your own header fields into the original email with some sort of id in it, yes you can do that. Assuming you're using the php mail() function, the fourth param lets you pass in additional mail headers, each line deliminted by an ending "\r\n". So you could have something like: $headers = "X-repId: $repid\r\n"; Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999180 Share on other sites More sharing options...
shane18 Posted January 21, 2010 Author Share Posted January 21, 2010 i didn't mean that I wanted to pass a php session id... it could be named anything as long as it stores a id # and when the person who receives my message replies to it, the id # carries with it... Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999192 Share on other sites More sharing options...
gizmola Posted January 21, 2010 Share Posted January 21, 2010 So --- then use some variation on the code I provided -- set and X- header, and your process that reads emails should parse for that. Since you haven't really described the application at all, that's the best I can offer. Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999196 Share on other sites More sharing options...
shane18 Posted January 21, 2010 Author Share Posted January 21, 2010 More or less, i need a way to send a e-mail to a mobile phone*will receive it as a txt*, and when the person hits reply and sends a message back.... all the emails will go to 1 email address... and i have a script that will read each one and based on a id passed along will sort it to the right user. what i can't figure out, is how to somehow pass a id along with the reply either through an header or some other way... Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999199 Share on other sites More sharing options...
gizmola Posted January 21, 2010 Share Posted January 21, 2010 I don't understand what you can't figure out. I have already suggested you a solution. Set an email header field with whatever value allows you to do the matching. This field name should start with X- See my code snippet. You would then need a custom program that will read emails out of the email box using imap or pop, and do whatever it is that you need to do, using the X- header value to establish your link. Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999253 Share on other sites More sharing options...
shane18 Posted January 21, 2010 Author Share Posted January 21, 2010 So if I create a X-Header... the header will carry with the replied e-mail? Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999326 Share on other sites More sharing options...
gizmola Posted January 21, 2010 Share Posted January 21, 2010 Well, unfortunately, no I don't think this will work. In my test, the mta does not carry over any headers. I think your only option is to include a tag in the actual body of the email, and then parse the body for it. You could for example include something like: [replycode: xxxxx] Perhaps at the bottom of the email, and use that to track it. Sorry but an email header will not work. One other thing you could do would be to set the reply-to address to include a portion of the address with the code. For example: Have it be Reply-To: someaddress_xxxxxxx. Your mta would need accept all these emails and send them to the same mailbox, and then use the To: address which will have the someaddress_xxxxxxx and parse it to get the response number. I know some customer service products that have implemented this scheme for tracking correspondence related to a particular case# Quote Link to comment https://forums.phpfreaks.com/topic/189266-imap-mail/#findComment-999504 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.