File tree 2 files changed +9
-7
lines changed
2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -210,16 +210,16 @@ exports.processMessage = function(data) {
210
210
fromText = 'From: ' + from . replace ( / < ( .* ) > / , '' ) . trim ( ) +
211
211
' <' + data . config . fromEmail + '>' ;
212
212
} else {
213
- // No name format
214
- fromText = 'From: ' + from . replace ( '@' , ' at ' ) +
213
+ // No display name format
214
+ fromText = 'From: ' + from . replace ( '@' , ' at ' ) . trim ( ) +
215
215
' <' + data . config . fromEmail + '>' ;
216
216
}
217
217
} else if ( from . indexOf ( '<' ) >= 0 && from . indexOf ( '>' ) >= 0 ) {
218
218
fromText = 'From: ' + from . replace ( '<' , 'at ' ) . replace ( '>' , '' ) +
219
219
' <' + data . originalRecipient + '>' ;
220
220
} else {
221
- // No name format
222
- fromText = 'From: ' + from . replace ( '@' , ' at ' ) +
221
+ // No display name format
222
+ fromText = 'From: ' + from . replace ( '@' , ' at ' ) . trim ( ) +
223
223
' <' + data . originalRecipient + '>' ;
224
224
}
225
225
return fromText ;
Original file line number Diff line number Diff line change @@ -36,7 +36,8 @@ describe('index.js', function() {
36
36
email : {
37
37
source : "betsy@example.com"
38
38
} ,
39
- emailData : fs . readFileSync ( "test/assets/message.simplefrom.txt" ) . toString ( ) ,
39
+ emailData :
40
+ fs . readFileSync ( "test/assets/message.simplefrom.txt" ) . toString ( ) ,
40
41
log : console . log ,
41
42
recipients : [ "jim@example.com" ] ,
42
43
originalRecipient : "info@example.com"
@@ -52,15 +53,16 @@ describe('index.js', function() {
52
53
} ) ;
53
54
} ) ;
54
55
55
- it ( 'should process email data and handle the simple from format having a custom fromMail ' , function ( done ) {
56
+ it ( 'should allow overriding the simple From header in emails ' , function ( done ) {
56
57
var data = {
57
58
config : {
58
59
fromEmail : "noreply@example.com"
59
60
} ,
60
61
email : {
61
62
source : "betsy@example.com"
62
63
} ,
63
- emailData : fs . readFileSync ( "test/assets/message.simplefrom.txt" ) . toString ( ) ,
64
+ emailData :
65
+ fs . readFileSync ( "test/assets/message.simplefrom.txt" ) . toString ( ) ,
64
66
log : console . log ,
65
67
recipients : [ "jim@example.com" ] ,
66
68
originalRecipient : "info@example.com"
You can’t perform that action at this time.
0 commit comments