@@ -56,19 +56,19 @@ public function testSenderFromHeaders()
56
56
$ headers->
addPathHeader (
'Return-Path ' ,
new NamedAddress (
'[email protected] ' ,
'return ' ));
57
57
$ headers->
addMailboxListHeader (
'To ' , [
'[email protected] ' ]);
58
58
$ e = SmtpEnvelope::create (new Message ($ headers ));
59
- $ this ->
assertEquals (
'[email protected] ' ,
$ e->
getSender ()-> getAddress ());
59
+ $ this ->
assertEquals (
new NamedAddress ( '[email protected] ' ,
' return ' ), $ e->
getSender ());
60
60
61
61
$ headers = new Headers ();
62
62
$ headers->
addMailboxHeader (
'Sender ' ,
new NamedAddress (
'[email protected] ' ,
'sender ' ));
63
63
$ headers->
addMailboxListHeader (
'To ' , [
'[email protected] ' ]);
64
64
$ e = SmtpEnvelope::create (new Message ($ headers ));
65
- $ this ->
assertEquals (
'[email protected] ' ,
$ e->
getSender ()-> getAddress ());
65
+ $ this ->
assertEquals (
new NamedAddress ( '[email protected] ' ,
' sender ' ), $ e->
getSender ());
66
66
67
67
$ headers = new Headers ();
68
68
$ headers->
addMailboxListHeader (
'From ' , [
new NamedAddress (
'[email protected] ' ,
'from ' ),
'[email protected] ' ]);
69
69
$ headers->
addMailboxListHeader (
'To ' , [
'[email protected] ' ]);
70
70
$ e = SmtpEnvelope::create (new Message ($ headers ));
71
- $ this ->
assertEquals (
'[email protected] ' ,
$ e->
getSender ()-> getAddress ());
71
+ $ this ->
assertEquals (
new NamedAddress ( '[email protected] ' ,
' from ' ), $ e->
getSender ());
72
72
}
73
73
74
74
public function testSenderFromHeadersWithoutFrom ()
@@ -77,17 +77,28 @@ public function testSenderFromHeadersWithoutFrom()
77
77
$ headers->
addMailboxListHeader (
'To ' , [
'[email protected] ' ]);
78
78
$ e = SmtpEnvelope::create ($ message = new Message ($ headers ));
79
79
$ message->
getHeaders ()->
addMailboxListHeader (
'From ' , [
new NamedAddress (
'[email protected] ' ,
'from ' )]);
80
- $ this ->
assertEquals (
'[email protected] ' ,
$ e->
getSender ()-> getAddress ());
80
+ $ this ->
assertEquals (
new NamedAddress ( '[email protected] ' ,
' from ' ), $ e->
getSender ());
81
81
}
82
82
83
83
public function testRecipientsFromHeaders ()
84
+ {
85
+ $ headers = new Headers ();
86
+ $ headers->
addPathHeader (
'Return-Path ' ,
'[email protected] ' );
87
+ $ headers->
addMailboxListHeader (
'To ' , [
new Address (
'[email protected] ' )]);
88
+ $ headers->
addMailboxListHeader (
'Cc ' , [
new Address (
'[email protected] ' )]);
89
+ $ headers->
addMailboxListHeader (
'Bcc ' , [
new Address (
'[email protected] ' )]);
90
+ $ e = SmtpEnvelope::create (new Message ($ headers ));
91
+ $ this ->
assertEquals ([
new Address (
'[email protected] ' ),
new Address (
'[email protected] ' ),
new Address (
'[email protected] ' )],
$ e->
getRecipients ());
92
+ }
93
+
94
+ public function testRecipientsFromHeadersWithNames ()
84
95
{
85
96
$ headers = new Headers ();
86
97
$ headers->
addPathHeader (
'Return-Path ' ,
'[email protected] ' );
87
98
$ headers->
addMailboxListHeader (
'To ' , [
new NamedAddress (
'[email protected] ' ,
'to ' )]);
88
99
$ headers->
addMailboxListHeader (
'Cc ' , [
new NamedAddress (
'[email protected] ' ,
'cc ' )]);
89
100
$ headers->
addMailboxListHeader (
'Bcc ' , [
new NamedAddress (
'[email protected] ' ,
'bcc ' )]);
90
101
$ e = SmtpEnvelope::create (new Message ($ headers ));
91
- $ this ->
assertEquals ([
new Address (
'[email protected] ' ),
new Address (
'[email protected] ' ),
new Address (
'[email protected] ' )],
$ e->
getRecipients ());
102
+ $ this ->
assertEquals ([
new NamedAddress (
'[email protected] ' , ' to ' ),
new NamedAddress (
'[email protected] ' , ' cc ' ),
new NamedAddress (
'[email protected] ' , ' bcc ')],
$ e->
getRecipients ());
92
103
}
93
104
}
0 commit comments