views:

99

answers:

2

hi

i want to add a enquiry id number to my emails so that when a user replies i i can automatically attach the email to an enquiry.

I am going to put a message with please do not remove this enquiry number when replying but it would be good if i can put a custom header with the enquiry number so the user doesnt see it.

Is this possible and is there any spam isssues addingh a custom header ?

best regards rick

+1  A: 

Easy to do, just use the headers method from your ActionMailer subclass

Per the email spec, start your non-standard headers with an X-

Eg X-enquiry-num, not enquiry-num

Also, don't count on the header not being stripped at some point in the mail transport/delivery/reply process. They usually get through, but not always.

Another way to do it: add you enquiry number to your From and Reply-To addresses. Use the + sign so the main part of the address will be valid. Eg Reply-To: [email protected]

-- A valid email address of [email protected] can have a + added and the mail will still be delivered to the same mailbox. Eg the same mailbox is used for [email protected], [email protected], [email protected]

Your sw that automatically reads and handles the incoming mail can view the complete To address and handle appropriately.

This technique is often used for automatically handling bounce messages send to a mailing list--emails are sent individually to everyone on the list with the person_id included as part of the reply-to and from addresses. That way the mailing list sw can automatically figure out which addresses bounced.

Larry K
thanks LarryWill this header be sent back to me in a reply email ?
rick moss
Yes, you should ("should", not "will") get headers back that you send out in the original msg. So your design needs to be flexible enough to also handle the cases where your headers have not been returned.
Larry K
+1  A: 

There are already standard headers In-Reply-To: and References: as listed in RFC-2076 "Common Internet Message Headers" that may do what you want. Both date back to RFC-822

These headers reference the Message-ID header.

Stephen P