[RCD] Getting message ID for selected message/message replied to

Daniel Böhmer post at daniel-boehmer.de
Mon Apr 22 22:25:29 CEST 2013


Hi,

this is how I got it partly working:

#####################################################
	function init() {
		$this->add_hook('message_headers_output', array($this, 'headers'));
	}

	function compose($args) {
		// retrieve RC's UID
		$reply_uid = $args['param']['reply_uid'];
		
		if($reply_uid) {
			// we are going to reply to some e-mail
			
			// fetch header block
			$rcube = rcube::get_instance();
			$storage = $rcube->get_storage();
			$header = $storage->get_raw_headers($reply_uid);
			
			/* doesn't work:
			$header = $storage->get_message_header($uid);
			$message_id = $header->get('message-id');
			 */
			
			// try to "parse"
			$matches = preg_match('/Message-I[dD]: (.+)/', $header, 
$message_ids);

			if($matches == 1) {
				$args['message-id'] = $message_ids[0];
				error_log("replying to " . $args['message-id']);
			}
		}
	}
#############################################


As you see in the comment you suggested solution with calling get() doesn't 
work for me. I always got values like "mid:12345" with 12345 being a random(?) 
number, probably another ID for that e-mail.

Using the raw header I am able to get the original message ID.

Unfortunately I don't find the value from $args['message-id'] with JavaScript. 
Where should it be?

I am not really happy with "parsing" the mail header on my own. Any 
suggestions why get('message-id') doesn't work?



Daniel Böhmer

-- 
Daniel Böhmer, Diplominformatiker (BA)
Freelance Software Developer

Diese E-Mail ist mit GnuPG digital signiert. Wenn GnuPG nicht verwendet 
wird, bitte die Datei "signature.asc" einfach ignorieren. //
This e-mail is digitally signed with GnuPG. If GnuPG is not used, 
please just ignore the file "signature.asc".
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.roundcube.net/pipermail/dev/attachments/20130422/ccba52f6/attachment.sig>


More information about the dev mailing list