## CreateAttachmentFromString(string, string) {#createattachmentfromstring_1}

Creates the attachment from string.

```csharp
public static Attachment CreateAttachmentFromString(string content, string name)
```

| Parameter | Type | Description |
| --- | --- | --- |
| content | String | A string that represents the content of attachment. |
| name | String | The attachment name. |

### Return Value

Returns created attachment

### See Also

* class [Attachment](../)
* namespace [Aspose.Email](../../attachment/)
* assembly [Aspose.Email](../../../)

---

## CreateAttachmentFromString(string, string, Encoding, string) {#createattachmentfromstring_2}

Creates the attachment from string.

```csharp
public static Attachment CreateAttachmentFromString(string content, string name, 
    Encoding contentEncoding, string mediaType)
```

| Parameter | Type | Description |
| --- | --- | --- |
| content | String | A string that represents the content of attachment. |
| name | String | The attachment name. |
| contentEncoding | Encoding | The content encoding. |
| mediaType | String | The media type name |

### Return Value

Returns created attachment

### See Also

* class [Attachment](../)
* namespace [Aspose.Email](../../attachment/)
* assembly [Aspose.Email](../../../)

---

## CreateAttachmentFromString(string, ContentType) {#createattachmentfromstring}

Creates the attachment from string.

```csharp
public static Attachment CreateAttachmentFromString(string content, ContentType contentType)
```

| Parameter | Type | Description |
| --- | --- | --- |
| content | String | A string that represents the content of attachment. |
| contentType | ContentType | The [`ContentType`](../../../aspose.email.mime/contenttype/). |

### Return Value

Returns created attachment

### See Also

* class [ContentType](../../../aspose.email.mime/contenttype/)
* class [Attachment](../)
* namespace [Aspose.Email](../../attachment/)
* assembly [Aspose.Email](../../../)


