Method CreateFromText
CreateFromText(string, string)
Creates a new Attachment from a plain-text string.
public static Attachment CreateFromText(string text, string name)
Parameters
textstringThe textual content to encode using UTF-8.
namestringThe file name to associate with the content (for example, ending with
.txt).
Returns
- Attachment
An Attachment carrying the provided text content.
Exceptions
- ArgumentNullException
Thrown if
textornameisnull.