开发者

custom email header

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开发者_Go百科 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


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: cust_svc+123@mycompany.com

-- A valid email address of foo@woof.com can have a + added and the mail will still be delivered to the same mailbox. Eg the same mailbox is used for foo@woof.com, foo+123@woof.com, foo+123_456@woof.com

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.


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.


You could use the message id. I've just starting using this in the format

<large_random_number+enquiry_id@domain_name.com>

and it seems to be returned consistently.

EG:

Content-Type:   multipart/alternative; boundary="------------070002000603000906000608"
Date:   Sat, 10 Nov 2012 17:23:48 +0100 [17:23:48 CET]
Delivery-date:  Sat, 10 Nov 2012 17:23:48 +0100
Envelope-to:    admin@some_domain.co.uk
From:   ChrisB <chrisb@example.com>
In-Reply-To:    <edIJcHTHHJUqC0LgtFkLBc8yNY6wypOkJgCoIXLSUuQ+12-0152@some_domain.co.uk>
MIME-Version:   1.0
Message-ID:     <509E7F94.4050304@example.com>
Received:   
References:     <edIJcHTHHJUqC0LgtFkLBc8yNY6wypOkJgCoIXLSUuQ+12-0152@some_domain.co.uk>
Return-path:    <chrisb@example.com>
Subject:    Re: BOOKING FORM
To:     <admin@some_domain.co.uk>
User-Agent:     Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121026 
Thunderbird/16.0.2
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜