# mailslurp.Api.AttachmentControllerApi
All URIs are relative to https://api.mailslurp.com
Method | HTTP request | Description |
---|---|---|
UploadAttachment | POST /attachments | Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment. |
UploadAttachmentBytes | POST /attachments/bytes | Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment. |
UploadMultipartForm | POST /attachments/multipart | Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment. |
# UploadAttachment
List<string> UploadAttachment (UploadAttachmentOptions uploadOptions)
Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions
when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
# Example
using System.Collections.Generic;
using System.Diagnostics;
using mailslurp.Api;
using mailslurp.Client;
using mailslurp.Model;
namespace Example
{
public class UploadAttachmentExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.mailslurp.com";
// Configure API key authorization: API_KEY
config.AddApiKey("x-api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("x-api-key", "Bearer");
var apiInstance = new AttachmentControllerApi(config);
var uploadOptions = new UploadAttachmentOptions(); // UploadAttachmentOptions | uploadOptions
try
{
// Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
List<string> result = apiInstance.UploadAttachment(uploadOptions);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachment: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
# Parameters
Name | Type | Description | Notes |
---|---|---|---|
uploadOptions | UploadAttachmentOptions | uploadOptions |
# Return type
List
# Authorization
# HTTP request headers
- Content-Type: application/json
- Accept: application/json
# HTTP response details
Status code | Description | Response headers |
---|---|---|
201 | Created | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
# UploadAttachmentBytes
List<string> UploadAttachmentBytes (string _string = null, string filename = null, byte[] byteArray = null)
Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions
when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
# Example
using System.Collections.Generic;
using System.Diagnostics;
using mailslurp.Api;
using mailslurp.Client;
using mailslurp.Model;
namespace Example
{
public class UploadAttachmentBytesExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.mailslurp.com";
// Configure API key authorization: API_KEY
config.AddApiKey("x-api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("x-api-key", "Bearer");
var apiInstance = new AttachmentControllerApi(config);
var _string = _string_example; // string | Optional contentType for file. For instance `application/pdf` (optional)
var filename = filename_example; // string | Optional filename to save upload with (optional)
var byteArray = BYTE_ARRAY_DATA_HERE; // byte[] | Byte array request body (optional)
try
{
// Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
List<string> result = apiInstance.UploadAttachmentBytes(_string, filename, byteArray);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachmentBytes: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
# Parameters
Name | Type | Description | Notes |
---|---|---|---|
_string | string | Optional contentType for file. For instance `application/pdf` | [optional] |
filename | string | Optional filename to save upload with | [optional] |
byteArray | byte[] | Byte array request body | [optional] |
# Return type
List
# Authorization
# HTTP request headers
- Content-Type: application/octet-stream
- Accept: application/json
# HTTP response details
Status code | Description | Response headers |
---|---|---|
201 | Created | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
# UploadMultipartForm
List<string> UploadMultipartForm (System.IO.Stream file, string contentType = null, string filename = null, string xFilename = null)
Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions
when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.
# Example
using System.Collections.Generic;
using System.Diagnostics;
using mailslurp.Api;
using mailslurp.Client;
using mailslurp.Model;
namespace Example
{
public class UploadMultipartFormExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.mailslurp.com";
// Configure API key authorization: API_KEY
config.AddApiKey("x-api-key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("x-api-key", "Bearer");
var apiInstance = new AttachmentControllerApi(config);
var file = BINARY_DATA_HERE; // System.IO.Stream | file
var contentType = contentType_example; // string | Optional content type of attachment (optional)
var filename = filename_example; // string | Optional name of file (optional)
var xFilename = xFilename_example; // string | Optional content type header of attachment (optional)
try
{
// Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
List<string> result = apiInstance.UploadMultipartForm(file, contentType, filename, xFilename);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadMultipartForm: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
# Parameters
Name | Type | Description | Notes |
---|---|---|---|
file | System.IO.Stream****System.IO.Stream | file | |
contentType | string | Optional content type of attachment | [optional] |
filename | string | Optional name of file | [optional] |
xFilename | string | Optional content type header of attachment | [optional] |
# Return type
List
# Authorization
# HTTP request headers
- Content-Type: multipart/form-data
- Accept: application/json
# HTTP response details
Status code | Description | Response headers |
---|---|---|
201 | Created | - |
401 | Unauthorized | - |
403 | Forbidden | - |
404 | Not Found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]