File tree 1 file changed +11
-2
lines changed 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -100,11 +100,20 @@ def send_raw_email(mail, args = {})
100
100
package = { 'RawMessage.Data' => Base64 ::encode64 ( message ) }
101
101
package [ 'Source' ] = args [ :from ] if args [ :from ]
102
102
package [ 'Source' ] = args [ :source ] if args [ :source ]
103
+
104
+ # Extract the list of recipients based on arguments or mail headers
105
+ destinations = [ ]
103
106
if args [ :destinations ]
104
- add_array_to_hash! ( package , 'Destinations' , args [ :destinations ] )
107
+ destinations . concat args [ :destinations ] . to_a
108
+ elsif args [ :to ]
109
+ destinations . concat args [ :to ] . to_a
105
110
else
106
- add_array_to_hash! ( package , 'Destinations' , args [ :to ] ) if args [ :to ]
111
+ destinations . concat mail . to . to_a
112
+ destinations . concat mail . cc . to_a
113
+ destinations . concat mail . bcc . to_a
107
114
end
115
+ add_array_to_hash! ( package , 'Destinations' , destinations ) if destinations . length > 0
116
+
108
117
request ( 'SendRawEmail' , package )
109
118
end
110
119
You can’t perform that action at this time.
0 commit comments