getLastMessageID() public method

Technically this is the value from the last time the headers were created, but it's also the message ID of the last sent message except in pathological cases.
public getLastMessageID ( ) : string
return string
 /**
  * Test setting and retrieving message ID.
  */
 public function testMessageID()
 {
     $this->Mail->Body = 'Test message ID.';
     $id = md5(12345);
     $this->Mail->MessageID = $id;
     $this->buildBody();
     $this->Mail->preSend();
     $lastid = $this->Mail->getLastMessageID();
     $this->assertEquals($lastid, $id, 'Custom Message ID mismatch');
 }
Example #2
0
 /**
  * Test setting and retrieving message ID.
  */
 public function testMessageID()
 {
     $this->Mail->Body = 'Test message ID.';
     $id = md5(12345);
     $this->Mail->MessageID = $id;
     $this->buildBody();
     $this->Mail->preSend();
     $lastid = $this->Mail->getLastMessageID();
     $this->assertNotEquals($lastid, $id, 'Invalid Message ID allowed');
     $id = '<' . md5(12345) . '@example.com>';
     $this->Mail->MessageID = $id;
     $this->buildBody();
     $this->Mail->preSend();
     $lastid = $this->Mail->getLastMessageID();
     $this->assertEquals($lastid, $id, 'Custom Message ID not used');
     $this->Mail->MessageID = '';
     $this->buildBody();
     $this->Mail->preSend();
     $lastid = $this->Mail->getLastMessageID();
     $this->assertRegExp('/^<.*@.*>$/', $lastid, 'Invalid default Message ID');
 }