EmailMessage.addAttachment

The attachmentFileName is what is shown to the user, not the file on your sending computer. It should NOT have a path in it. If you want a filename from your computer, try addFileAsAttachment.

The mimeType can be excluded if the filename has a common extension supported by the library.

message.addAttachment("text/plain", "something.txt", std.file.read("/path/to/local/something.txt"));
  1. void addAttachment(string mimeType, string attachmentFileName, void[] content, string id)
  2. void addAttachment(string attachmentFileName, void[] content, string id)
    class EmailMessage
    void
    addAttachment
    (,
    const void[] content
    ,
    string id = null
    )

Meta

History

The overload without mimeType was added October 28, 2024.

The parameter attachmentFileName was previously called filename. This was changed for clarity and consistency with other overloads on October 28, 2024.