address() public method

Add a single address with optional name
public address ( string $email, string $name = null ) : Mail
$email string The email address e.g. john@example.com
$name string The name for the address e.g. John Doe
return Mail
Beispiel #1
0
 public function testAdresses()
 {
     $mail = new Mail();
     $mail->address('*****@*****.**');
     $mail->address('*****@*****.**', 'John Doe');
     $mail->adresses(['*****@*****.**', 'Jane Doe' => '*****@*****.**']);
     $mailerTo = $mail->mailer->getToAddresses();
     $this->assertSame('*****@*****.**', $mailerTo[0][0]);
     $this->assertSame('*****@*****.**', $mailerTo[0][1]);
     $this->assertSame('*****@*****.**', $mailerTo[1][0]);
     $this->assertSame('John Doe', $mailerTo[1][1]);
     $this->assertSame('*****@*****.**', $mailerTo[2][0]);
     $this->assertSame('*****@*****.**', $mailerTo[2][1]);
     $this->assertSame('*****@*****.**', $mailerTo[3][0]);
     $this->assertSame('Jane Doe', $mailerTo[3][1]);
 }