# Setting messageid in mailer

**URL:** <https://www.ruby-forum.com/t/setting-messageid-in-mailer/49720>\
**Category:** Rails\
**Created:** [December 8, 2005, 12:09am UTC](https://www.ruby-forum.com/t/setting-messageid-in-mailer/49720 "2005-12-08T00:09:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.rynne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9fc29f/32.png) [@thomas.rynne](https://www.ruby-forum.com/u/thomas.rynne)\
**Post date:** [December 8, 2005, 12:09am UTC](https://www.ruby-forum.com/t/setting-messageid-in-mailer/49720/1 "2005-12-08T00:09:51Z")

</div>

Hi,  
I want to set the message-id of the messages sent using the mailer (so  
that  
I can recognise replies). Has anyone done this?

I’ve tried these in my mailer model:  
@headers[“message-id”] = “12345”  
#gets ignored  
and  
message\_id = “12345”  
#gets ignored  
and this separate bit of code:  
mail = MyMailer.create\_reminder\_message(user)  
mail.message\_id = "123  
MyMailer.deliver(mail)  
#there’s no deliver method on MyMailer

Any ideas?

thanks  
Thomas

---

<div class="post-metadata">

**Author:** ![thomas.rynne](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/9fc29f/32.png) [@thomas.rynne](https://www.ruby-forum.com/u/thomas.rynne)\
**Post date:** [December 9, 2005, 6:43am UTC](https://www.ruby-forum.com/t/setting-messageid-in-mailer/49720/2 "2005-12-09T06:43:49Z")

</div>

On Dec 7, 2005, at 6:08 PM, Thomas Rynne wrote:

> Hi,  
> I want to set the message-id of the messages sent using the mailer  
> (so that  
> I can recognise replies). Has anyone done this?
> 
> and this separate bit of code:  
> mail = MyMailer.create\_reminder\_message(user)  
> mail.message\_id = "123  
> MyMailer.deliver(mail)  
> #there’s no deliver method on MyMailer

This method should definitely work, I am using it with success. The  
deliver  
method is set up by action mailer, it is not a method you add to  
MyMailer  
yourself.

You might also consider using TMail.new\_message\_id to create a message  
id:

mail.message\_id = TMail.new\_message\_id

–  
Scott B.  
Lunchbox Software  
[http://lunchboxsoftware.com](http://lunchboxsoftware.com)  
[http://lunchroom.lunchboxsoftware.com](http://lunchroom.lunchboxsoftware.com)  
[http://rubyi.st](http://rubyi.st)
