ZF-2624: Message-ID getter/setter

Issue Type: Improvement Created: 2008-02-12T11:31:10.000+0000 Last Updated: 2012-03-28T02:16:36.000+0000 Status: Resolved Fix version(s): - 1.7.3 (19/Jan/09)

Reporter: Gianluca Sforna (giallu) Assignee: Satoru Yoshida (satoruyoshida) Tags: - Zend_Mail

Related issues: Attachments: - ZF-2624.patch


I'm evaluating moving Mantis issue tracker code ( from phpmailer to Zend::Mail.
When notification mails are sent from a mantis installation, the Message-ID is set in such a way that subsequent mails coming from the same issue are threaded properly by email readers.

Right now, I can not find (neither in 1.5PR) any method for setting and getting the value of the Message-ID header, so this is clearly a blocker, at least in my use case.


Posted by Wil Sinclair (wil) on 2008-04-18T15:48:53.000+0000

Please evaluate and categorize/assign as necessary.

Posted by Gianluca Sforna (giallu) on 2008-04-19T03:03:33.000+0000

Will, I guess your comment is not addressed to me?

Posted by Wil Sinclair (wil) on 2008-08-04T08:17:33.000+0000

No. I was addressing Nico, who is the lead for the Zend_Mail component. Would you like to fix this one yourself?

Posted by Gianluca Sforna (giallu) on 2008-08-20T00:43:28.000+0000

The attached patch provides the required functions.

I am not sure if the setMessageId() method needs the same "sanitization" as you do in other header setters like setSubject(); that would be trivial to add though

Posted by Gianluca Sforna (giallu) on 2008-08-20T13:30:35.000+0000

Will, Nico, are there any chances this could be reviewed/pushed to SVN in time for 1.6 gold?

Posted by Gianluca Sforna (giallu) on 2008-09-09T07:34:45.000+0000

Ok, now that 1.6 is released, are you able to assign a target version to this?

Posted by Nico Edtinger (nico) on 2008-09-12T12:48:30.000+0000

Hadn't much time lately, but my current target for most mail issues is 1.7.

One question about this. You say you want the mails to be in the correct thread. Wouldn't it be more correct to add a message-id to the references header? I don't know how you decide to which thread a message belongs, but it seems like you'd sending several messages with the same message-id, which is not correct.

Posted by Gianluca Sforna (giallu) on 2008-09-13T07:59:47.000+0000

Yes, re-reading the description I realize the wording was not really clear.

Basically, the first mail we send on bug creation has a Message-ID composed from some unique data about the bug (ID, creation timestamp, etc).

When notes are added or other events trigger a mail to be sent, we are able to set a "In-Reply-To" header with the original Message-ID, and threading works as expected.

Posted by Gianluca Sforna (giallu) on 2008-11-12T14:27:32.000+0000

Anything more I can do here?

Posted by Gianluca Sforna (giallu) on 2008-12-13T08:56:55.000+0000


Posted by old of Satoru Yoshida ( on 2009-01-03T07:30:52.000+0000

I think following is better.

  1. At first , user calls enableMessageId() function that enables creating id before sending message. for example,

public function enableMessageId($flag) { $this->_useMessageId = (boolean) $flag; }

2)At second, user calls send method without calling creating id method.

send() method has creating message id logic,

if ($this->_useMessageId === true) { //Here is logic that creates message id. }

  1. Thus, each time own id will be created without forgetting change value.

Posted by Nico Edtinger (nico) on 2009-01-03T18:23:36.000+0000

We can support both. Make it public function setMessageId($id = true) If $id is null or false no message-id header is added, if it's true a new id is generated, else the given one is taken. I didn't had the time to really look into the format for message-ids, but we already have to generate unique ids for writing to maildir. If we could reuse the functionality (making it a static method in Zend_Mail), that would be great.

Posted by Gianluca Sforna (giallu) on 2009-01-05T09:41:50.000+0000

Nico, I guess you did not notice my patch?

Posted by old of Satoru Yoshida ( on 2009-01-05T23:29:45.000+0000

Hi, Gianluca Sforna . I will try to update this issue in next holiday ;-)

Posted by Gianluca Sforna (giallu) on 2009-01-06T00:58:13.000+0000

Hi Satoru (I guess that's your first name... mine is Gianluca); nice to see some activity here!

I just hope the next holiday where you live is not next Christmas ;)

Feel free to let me know if/how my patch should be revised and I can provide you an updated one.

Posted by old of Satoru Yoshida ( on 2009-01-08T08:50:47.000+0000

Solved in SVN r13555

I added 4 methods.

setMessageId, getMessageId, clearMessageId, createMessageId.

Hi, Gianluca Thank you for your kindness, but never mind. I am not in the Orthodox church, a Buddhist :-)

I will be happy if you try new functions!

Posted by old of Satoru Yoshida ( on 2009-01-14T21:29:30.000+0000

Additional Fix in SVN r13643.

Message-Id should be error on addHeader() function.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.