@@ -530,7 +530,7 @@ Message.prototype._send = function(socket, options, autosend) {
530530 builder = '' ;
531531 }
532532
533- message . push ( 'Content-Type: multipart/mixed ; boundary=' + boundary ) ;
533+ message . push ( 'Content-Type: multipart/alternative ; boundary=' + boundary ) ;
534534 message . push ( '' ) ;
535535 message . push ( '--' + boundary ) ;
536536 message . push ( 'Content-Type: ' + ( self . body . indexOf ( '<' ) !== - 1 && self . body . lastIndexOf ( '>' ) !== - 1 ? 'text/html' : 'text/plain' ) + '; charset=utf-8' ) ;
@@ -721,24 +721,25 @@ Message.prototype._writeAttachment = function(write, boundary, socket) {
721721 var name = attachment . name ;
722722 var stream = fs . createReadStream ( attachment . filename , { encoding : 'base64' } ) ;
723723 var message = [ ] ;
724-
725- message . push ( '--' + boundary ) ;
726-
727- if ( attachment . contentId ) {
728- message . push ( 'Content-Disposition: inline; filename="' + name + '"' ) ;
729- message . push ( 'Content-ID: <' + attachment . contentId + '>' ) ;
730- } else
731- message . push ( 'Content-Disposition: attachment; filename="' + name + '"' ) ;
732-
733724 var extension = 'dat' ;
734725 var index = attachment . filename . lastIndexOf ( '.' ) ;
735726
736- if ( index = == - 1 )
727+ if ( index ! == - 1 )
737728 extension = attachment . filename . substring ( index + 1 ) . toLowerCase ( ) ;
738729
739730 var isCalendar = extension === 'ics' ;
740731
741- message . push ( 'Content-Type: ' + framework_utils . getContentType ( extension ) + ';' + ( isCalendar ? ' charset="utf-8"; method=REQUEST;' : '' ) ) ;
732+ message . push ( '--' + boundary ) ;
733+
734+ if ( ! isCalendar ) {
735+ if ( attachment . contentId ) {
736+ message . push ( 'Content-Disposition: inline; filename="' + name + '"' ) ;
737+ message . push ( 'Content-ID: <' + attachment . contentId + '>' ) ;
738+ } else
739+ message . push ( 'Content-Disposition: attachment; filename="' + name + '"' ) ;
740+ }
741+
742+ message . push ( 'Content-Type: ' + framework_utils . getContentType ( extension ) + ';' + ( isCalendar ? ' charset="utf-8"; method=REQUEST' : '' ) ) ;
742743 message . push ( 'Content-Transfer-Encoding: base64' ) ;
743744 message . push ( CRLF ) ;
744745
0 commit comments