Skip to content

AttachString

Attaches the given string as a plain text attachment to the message.

1
myMessage.AttachString(fileName: string, mimeType: string, content: string):Message

Parameters

string fileName
    The file name of the attachment.

string mimeType
    The MIME type of the attachment.

string content
    The text content of the attachment.

Returns

The current message instance.

Examples

Attach a CSV report

1
2
3
4
5
6
7
var csv = 'Product;Quantity\n' + $Xml.SelectAll('Lines/Line', function (line) {
    return line.Evaluate('Product') + ';' + line.Evaluate('Quantity');
}).join('\n');

$Messages.New('[email protected]', 'Order lines', 'The order lines are attached.')
    .AttachString('lines.csv', 'text/csv', csv)
    .Send();

See Also