Craig Rushforth
Craig Rushforth

Reputation: 223

retrieve $MessageID from phpmailer

I have just set up phpmailer, and i want to store messages in a log table on send.

phpmailer creates a messageid automatically, how can i retrieve $MessageID it so i can store it in my table ?

i don't need to set it, but i tried this...

$MID = time() .'-' . md5('xxx@gmail.com' . 'yyy@gmail.com') . '@domain.com';
$mail->MessageID = $MID;

and the header on the sent email is different

would be happy just to retrieve the default one

Upvotes: 5

Views: 1859

Answers (1)

Piotr Dawidiuk
Piotr Dawidiuk

Reputation: 3092

There is a method getLastMessageID that you can use.

How about setting your own value? You must remember, that

the structure of MessageID should be:

<sometext@sometext>

If your MessageID doesn't have this exact structure - PHPMailer will ignore your MessageId and generate it's own MessageId.

Upvotes: 5

Related Questions