class MailSlurpClient::EmailControllerApi
Attributes
Public Class Methods
# File lib/mailslurp_client/api/email_controller_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete all emails in all inboxes. Deletes all emails in your account. Be careful as emails cannot be recovered @param [Hash] opts the optional parameters @return [nil]
# File lib/mailslurp_client/api/email_controller_api.rb, line 26 def delete_all_emails(opts = {}) delete_all_emails_with_http_info(opts) nil end
Delete all emails in all inboxes. Deletes all emails in your account. Be careful as emails cannot be recovered @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 35 def delete_all_emails_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_all_emails ...' end # resource path local_var_path = '/emails' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#delete_all_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. @param email_id [String] ID of email to delete @param [Hash] opts the optional parameters @return [nil]
# File lib/mailslurp_client/api/email_controller_api.rb, line 81 def delete_email(email_id, opts = {}) delete_email_with_http_info(email_id, opts) nil end
Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered. @param email_id [String] ID of email to delete @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 91 def delete_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.delete_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.delete_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#delete_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. @return [String]
# File lib/mailslurp_client/api/email_controller_api.rb, line 143 def download_attachment(attachment_id, email_id, opts = {}) data, _status_code, _headers = download_attachment_with_http_info(attachment_id, email_id, opts) data end
Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [DownloadAttachmentDto]
# File lib/mailslurp_client/api/email_controller_api.rb, line 213 def download_attachment_base64(attachment_id, email_id, opts = {}) data, _status_code, _headers = download_attachment_base64_with_http_info(attachment_id, email_id, opts) data end
Get email attachment as base64 encoded string as an alternative to binary responses. Decode the `base64FileContents` as a `utf-8` encoded string or array of bytes depending on the `contentType`. Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the `downloadAttachment` method but allows some clients to get around issues with binary responses. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(DownloadAttachmentDto
, Integer, Hash)>] DownloadAttachmentDto
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 224 def download_attachment_base64_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment_base64 ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment_base64" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment_base64" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'DownloadAttachmentDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#download_attachment_base64\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email attachment bytes. Returned as `octet-stream` with content type header. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints and convert the base 64 encoded content to a file or string. Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @option opts [String] :api_key Can pass apiKey in url for this request if you wish to download the file in a browser. Content type will be set to original content type of the attachment file. This is so that browsers can download the file correctly. @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 155 def download_attachment_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_attachment ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.download_attachment" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_attachment" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'apiKey'] = opts[:'api_key'] if !opts[:'api_key'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#download_attachment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email body as string. Returned as `plain/text` with content type header. Returns the specified email body for a given email as a string @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [String]
# File lib/mailslurp_client/api/email_controller_api.rb, line 280 def download_body(email_id, opts = {}) data, _status_code, _headers = download_body_with_http_info(email_id, opts) data end
Get email body in bytes. Returned as `octet-stream` with content type header. Returns the specified email body for a given email as a stream / array of bytes. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [String]
# File lib/mailslurp_client/api/email_controller_api.rb, line 342 def download_body_bytes(email_id, opts = {}) data, _status_code, _headers = download_body_bytes_with_http_info(email_id, opts) data end
Get email body in bytes. Returned as `octet-stream` with content type header. Returns the specified email body for a given email as a stream / array of bytes. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 352 def download_body_bytes_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_body_bytes ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_body_bytes" end # resource path local_var_path = '/emails/{emailId}/body-bytes'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#download_body_bytes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email body as string. Returned as `plain/text` with content type header. Returns the specified email body for a given email as a string @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 290 def download_body_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.download_body ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.download_body" end # resource path local_var_path = '/emails/{emailId}/body'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/html', 'text/plain']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#download_body\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Forward email to recipients Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. @param email_id [String] ID of email @param forward_email_options [ForwardEmailOptions] forwardEmailOptions @param [Hash] opts the optional parameters @return [SentEmailDto]
# File lib/mailslurp_client/api/email_controller_api.rb, line 405 def forward_email(email_id, forward_email_options, opts = {}) data, _status_code, _headers = forward_email_with_http_info(email_id, forward_email_options, opts) data end
Forward email to recipients Forward an existing email to new recipients. The sender of the email will be the inbox that received the email you are forwarding. You can override the sender with the `from` option. Note you must have access to the from address in MailSlurp to use the override. For more control consider fetching the email and sending it a new using the send email endpoints. @param email_id [String] ID of email @param forward_email_options [ForwardEmailOptions] forwardEmailOptions @param [Hash] opts the optional parameters @return [Array<(SentEmailDto
, Integer, Hash)>] SentEmailDto
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 416 def forward_email_with_http_info(email_id, forward_email_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.forward_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.forward_email" end # verify the required parameter 'forward_email_options' is set if @api_client.config.client_side_validation && forward_email_options.nil? fail ArgumentError, "Missing the required parameter 'forward_email_options' when calling EmailControllerApi.forward_email" end # resource path local_var_path = '/emails/{emailId}/forward'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(forward_email_options) # return_type return_type = opts[:return_type] || 'SentEmailDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#forward_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. Returns the metadata such as name and content-type for a given attachment and email. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [AttachmentMetaData]
# File lib/mailslurp_client/api/email_controller_api.rb, line 475 def get_attachment_meta_data(attachment_id, email_id, opts = {}) data, _status_code, _headers = get_attachment_meta_data_with_http_info(attachment_id, email_id, opts) data end
Get email attachment metadata. This is the `contentType` and `contentLength` of an attachment. To get the individual attachments use the `downloadAttachment` methods. Returns the metadata such as name and content-type for a given attachment and email. @param attachment_id [String] ID of attachment @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(AttachmentMetaData
, Integer, Hash)>] AttachmentMetaData
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 486 def get_attachment_meta_data_with_http_info(attachment_id, email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachment_meta_data ...' end # verify the required parameter 'attachment_id' is set if @api_client.config.client_side_validation && attachment_id.nil? fail ArgumentError, "Missing the required parameter 'attachment_id' when calling EmailControllerApi.get_attachment_meta_data" end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachment_meta_data" end # resource path local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'attachmentId' + '}', CGI.escape(attachment_id.to_s)).sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'AttachmentMetaData' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_attachment_meta_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all email attachment metadata. Metadata includes name and size of attachments. Returns an array of attachment metadata such as name and content-type for a given email if present. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<AttachmentMetaData>]
# File lib/mailslurp_client/api/email_controller_api.rb, line 542 def get_attachments1(email_id, opts = {}) data, _status_code, _headers = get_attachments1_with_http_info(email_id, opts) data end
Get all email attachment metadata. Metadata includes name and size of attachments. Returns an array of attachment metadata such as name and content-type for a given email if present. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(Array<AttachmentMetaData>, Integer, Hash)>] Array<AttachmentMetaData> data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 552 def get_attachments1_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_attachments1 ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_attachments1" end # resource path local_var_path = '/emails/{emailId}/attachments'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Array<AttachmentMetaData>' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_attachments1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing (default to false) @return [Email]
# File lib/mailslurp_client/api/email_controller_api.rb, line 605 def get_email(email_id, opts = {}) data, _status_code, _headers = get_email_with_http_info(email_id, opts) data end
Get email content regex pattern match results. Runs regex against email body and returns match groups. Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. @param email_id [String] ID of email to match against @param content_match_options [ContentMatchOptions] contentMatchOptions @param [Hash] opts the optional parameters @return [EmailContentMatchResult]
# File lib/mailslurp_client/api/email_controller_api.rb, line 670 def get_email_content_match(email_id, content_match_options, opts = {}) data, _status_code, _headers = get_email_content_match_with_http_info(email_id, content_match_options, opts) data end
Get email content regex pattern match results. Runs regex against email body and returns match groups. Return the matches for a given Java style regex pattern. Do not include the typical `/` at start or end of regex in some languages. Given an example `your code is: 12345` the pattern to extract match looks like `code is: (\d{6})`. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: `['code is: 123456', '123456']` See docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns. @param email_id [String] ID of email to match against @param content_match_options [ContentMatchOptions] contentMatchOptions @param [Hash] opts the optional parameters @return [Array<(EmailContentMatchResult
, Integer, Hash)>] EmailContentMatchResult
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 681 def get_email_content_match_with_http_info(email_id, content_match_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_content_match ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_content_match" end # verify the required parameter 'content_match_options' is set if @api_client.config.client_side_validation && content_match_options.nil? fail ArgumentError, "Missing the required parameter 'content_match_options' when calling EmailControllerApi.get_email_content_match" end # resource path local_var_path = '/emails/{emailId}/contentMatch'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(content_match_options) # return_type return_type = opts[:return_type] || 'EmailContentMatchResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email_content_match\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email content as HTML. For displaying emails in browser context. Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :decode decode (default to false) @return [String]
# File lib/mailslurp_client/api/email_controller_api.rb, line 740 def get_email_html(email_id, opts = {}) data, _status_code, _headers = get_email_html_with_http_info(email_id, opts) data end
Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors @param email_id [String] ID of email to perform HTML query on @param [Hash] opts the optional parameters @option opts [String] :html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. @return [EmailTextLinesResult]
# File lib/mailslurp_client/api/email_controller_api.rb, line 805 def get_email_html_query(email_id, opts = {}) data, _status_code, _headers = get_email_html_query_with_http_info(email_id, opts) data end
Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of text. HTML parsing uses JSoup which supports JQuery/CSS style selectors @param email_id [String] ID of email to perform HTML query on @param [Hash] opts the optional parameters @option opts [String] :html_selector HTML selector to search for. Uses JQuery/JSoup/CSS style selector like '.my-div' to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information. @return [Array<(EmailTextLinesResult
, Integer, Hash)>] EmailTextLinesResult
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 816 def get_email_html_query_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html_query ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html_query" end # resource path local_var_path = '/emails/{emailId}/htmlQuery'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'htmlSelector'] = opts[:'html_selector'] if !opts[:'html_selector'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailTextLinesResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email_html_query\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email content as HTML. For displaying emails in browser context. Retrieve email content as HTML response for viewing in browsers. Decodes quoted-printable entities and converts charset to UTF-8. Pass your API KEY as a request parameter when viewing in a browser: `?apiKey=xxx` @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :decode decode @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 751 def get_email_html_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_html" end # resource path local_var_path = '/emails/{emailId}/html'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/html']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email_html\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Parse and return list of links found in an email (only works for HTML content) HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes @param email_id [String] ID of email to fetch text for @param [Hash] opts the optional parameters @return [EmailLinksResult]
# File lib/mailslurp_client/api/email_controller_api.rb, line 869 def get_email_links(email_id, opts = {}) data, _status_code, _headers = get_email_links_with_http_info(email_id, opts) data end
Parse and return list of links found in an email (only works for HTML content) HTML parsing uses JSoup and UNIX line separators. Searches content for href attributes @param email_id [String] ID of email to fetch text for @param [Hash] opts the optional parameters @return [Array<(EmailLinksResult
, Integer, Hash)>] EmailLinksResult
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 879 def get_email_links_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_links ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_links" end # resource path local_var_path = '/emails/{emailId}/links'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailLinksResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email_links\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. @param email_id [String] ID of email to fetch text for @param [Hash] opts the optional parameters @option opts [Boolean] :decode_html_entities Decode HTML entities @option opts [String] :line_separator Line separator character @return [EmailTextLinesResult]
# File lib/mailslurp_client/api/email_controller_api.rb, line 933 def get_email_text_lines(email_id, opts = {}) data, _status_code, _headers = get_email_text_lines_with_http_info(email_id, opts) data end
Parse and return text from an email, stripping HTML and decoding encoded characters Parse an email body and return the content as an array of strings. HTML parsing uses JSoup and UNIX line separators. @param email_id [String] ID of email to fetch text for @param [Hash] opts the optional parameters @option opts [Boolean] :decode_html_entities Decode HTML entities @option opts [String] :line_separator Line separator character @return [Array<(EmailTextLinesResult
, Integer, Hash)>] EmailTextLinesResult
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 945 def get_email_text_lines_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_text_lines ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email_text_lines" end # resource path local_var_path = '/emails/{emailId}/textLines'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decodeHtmlEntities'] = opts[:'decode_html_entities'] if !opts[:'decode_html_entities'].nil? query_params[:'lineSeparator'] = opts[:'line_separator'] if !opts[:'line_separator'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailTextLinesResult' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email_text_lines\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get email content including headers and body. Expects email to exist by ID. For emails that may not have arrived yet use the WaitForController. Returns a email summary object with headers and content. To retrieve the raw unparsed email use the getRawEmail endpoints @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :decode Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance `=D7`). This can be a pain for testing @return [Array<(Email
, Integer, Hash)>] Email
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 616 def get_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'decode'] = opts[:'decode'] if !opts[:'decode'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all emails in all inboxes in paginated form. Email
API list all. By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages @param [Hash] opts the optional parameters @option opts [DateTime] :before Optional filter emails received before given date time @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. @option opts [Integer] :page Optional page index in email list pagination (default to 0) @option opts [String] :search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body (default to 'false') @option opts [DateTime] :since Optional filter emails received after given date time @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20) @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false) @return [PageEmailProjection]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1006 def get_emails_paginated(opts = {}) data, _status_code, _headers = get_emails_paginated_with_http_info(opts) data end
Get all emails in all inboxes in paginated form. Email
API list all. By default returns all emails across all inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages @param [Hash] opts the optional parameters @option opts [DateTime] :before Optional filter emails received before given date time @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. @option opts [Integer] :page Optional page index in email list pagination @option opts [String] :search_filter Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body @option opts [DateTime] :since Optional filter emails received after given date time @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results @option opts [String] :sort Optional createdAt sort direction ASC or DESC @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly @return [Array<(PageEmailProjection
, Integer, Hash)>] PageEmailProjection
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1023 def get_emails_paginated_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_emails_paginated ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/emails' # query parameters query_params = opts[:query_params] || {} query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageEmailProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get gravatar url for email address @param email_address [String] emailAddress @param [Hash] opts the optional parameters @option opts [String] :size size @return [GravatarUrl]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1083 def get_gravatar_url_for_email_address(email_address, opts = {}) data, _status_code, _headers = get_gravatar_url_for_email_address_with_http_info(email_address, opts) data end
Get gravatar url for email address @param email_address [String] emailAddress @param [Hash] opts the optional parameters @option opts [String] :size size @return [Array<(GravatarUrl
, Integer, Hash)>] GravatarUrl
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1093 def get_gravatar_url_for_email_address_with_http_info(email_address, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_gravatar_url_for_email_address ...' end # verify the required parameter 'email_address' is set if @api_client.config.client_side_validation && email_address.nil? fail ArgumentError, "Missing the required parameter 'email_address' when calling EmailControllerApi.get_gravatar_url_for_email_address" end # resource path local_var_path = '/emails/gravatarFor' # query parameters query_params = opts[:query_params] || {} query_params[:'emailAddress'] = email_address query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'GravatarUrl' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_gravatar_url_for_email_address\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs @param [Hash] opts the optional parameters @option opts [Array<String>] :inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes @return [Email]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1147 def get_latest_email(opts = {}) data, _status_code, _headers = get_latest_email_with_http_info(opts) data end
Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. Get the newest email in all inboxes or in a passed set of inbox IDs @param [Hash] opts the optional parameters @option opts [String] :inbox_id ID of the inbox you want to get the latest email from @return [Email]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1206 def get_latest_email_in_inbox(opts = {}) data, _status_code, _headers = get_latest_email_in_inbox_with_http_info(opts) data end
Get latest email in an inbox. Use `WaitForController` to get emails that may not have arrived yet. Get the newest email in all inboxes or in a passed set of inbox IDs @param [Hash] opts the optional parameters @option opts [String] :inbox_id ID of the inbox you want to get the latest email from @return [Array<(Email
, Integer, Hash)>] Email
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1216 def get_latest_email_in_inbox_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email_in_inbox ...' end # resource path local_var_path = '/emails/latestIn' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_latest_email_in_inbox\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs @param [Hash] opts the optional parameters @option opts [Array<String>] :inbox_ids Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes @return [Array<(Email
, Integer, Hash)>] Email
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1157 def get_latest_email_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email ...' end # resource path local_var_path = '/emails/latest' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxIds'] = @api_client.build_collection_param(opts[:'inbox_ids'], :multi) if !opts[:'inbox_ids'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'Email' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_latest_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get all organization emails. List team or shared test email accounts By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages @param [Hash] opts the optional parameters @option opts [DateTime] :before Optional filter emails received before given date time @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. @option opts [Integer] :page Optional page index in email list pagination (default to 0) @option opts [String] :search_filter Optional search filter search filter for emails. @option opts [DateTime] :since Optional filter emails received after given date time @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20) @option opts [String] :sort Optional createdAt sort direction ASC or DESC (default to 'ASC') @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false) @return [PageEmailProjection]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1272 def get_organization_emails_paginated(opts = {}) data, _status_code, _headers = get_organization_emails_paginated_with_http_info(opts) data end
Get all organization emails. List team or shared test email accounts By default returns all emails across all team inboxes sorted by ascending created at date. Responses are paginated. You can restrict results to a list of inbox IDs. You can also filter out read messages @param [Hash] opts the optional parameters @option opts [DateTime] :before Optional filter emails received before given date time @option opts [Array<String>] :inbox_id Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account. @option opts [Integer] :page Optional page index in email list pagination @option opts [String] :search_filter Optional search filter search filter for emails. @option opts [DateTime] :since Optional filter emails received after given date time @option opts [Integer] :size Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results @option opts [String] :sort Optional createdAt sort direction ASC or DESC @option opts [Boolean] :unread_only Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly @return [Array<(PageEmailProjection
, Integer, Hash)>] PageEmailProjection
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1289 def get_organization_emails_paginated_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_organization_emails_paginated ...' end allowable_values = ["ASC", "DESC"] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end # resource path local_var_path = '/emails/organization' # query parameters query_params = opts[:query_params] || {} query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil? query_params[:'inboxId'] = @api_client.build_collection_param(opts[:'inbox_id'], :multi) if !opts[:'inbox_id'].nil? query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil? query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil? query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil? query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'unreadOnly'] = opts[:'unread_only'] if !opts[:'unread_only'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'PageEmailProjection' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_organization_emails_paginated\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get raw email string. Returns unparsed raw SMTP message with headers and body. Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [String]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1349 def get_raw_email_contents(email_id, opts = {}) data, _status_code, _headers = get_raw_email_contents_with_http_info(email_id, opts) data end
Get raw email string. Returns unparsed raw SMTP message with headers and body. Returns a raw, unparsed, and unprocessed email. If your client has issues processing the response it is likely due to the response content-type which is text/plain. If you need a JSON response content-type use the getRawEmailJson endpoint @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1359 def get_raw_email_contents_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_contents ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_contents" end # resource path local_var_path = '/emails/{emailId}/raw'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['text/plain']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'String' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_raw_email_contents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [RawEmailJson]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1411 def get_raw_email_json(email_id, opts = {}) data, _status_code, _headers = get_raw_email_json_with_http_info(email_id, opts) data end
Get raw email in JSON. Unparsed SMTP message in JSON wrapper format. Returns a raw, unparsed, and unprocessed email wrapped in a JSON response object for easier handling when compared with the getRawEmail text/plain response @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(RawEmailJson
, Integer, Hash)>] RawEmailJson
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1421 def get_raw_email_json_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_raw_email_json ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.get_raw_email_json" end # resource path local_var_path = '/emails/{emailId}/raw/json'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'RawEmailJson' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_raw_email_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get unread email count Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response @param [Hash] opts the optional parameters @return [UnreadCount]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1472 def get_unread_email_count(opts = {}) data, _status_code, _headers = get_unread_email_count_with_http_info(opts) data end
Get unread email count Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response @param [Hash] opts the optional parameters @return [Array<(UnreadCount
, Integer, Hash)>] UnreadCount
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1481 def get_unread_email_count_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_unread_email_count ...' end # resource path local_var_path = '/emails/unreadCount' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'UnreadCount' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#get_unread_email_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Mark an email as read on unread Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :read What value to assign to email read property. Default true. (default to true) @return [EmailPreview]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1530 def mark_as_read(email_id, opts = {}) data, _status_code, _headers = mark_as_read_with_http_info(email_id, opts) data end
Mark an email as read on unread Marks an email as read or unread. Pass boolean read flag to set value. This is useful if you want to read an email but keep it as unread @param email_id [String] emailId @param [Hash] opts the optional parameters @option opts [Boolean] :read What value to assign to email read property. Default true. @return [Array<(EmailPreview
, Integer, Hash)>] EmailPreview
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1541 def mark_as_read_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.mark_as_read ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.mark_as_read" end # resource path local_var_path = '/emails/{emailId}/read'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'read'] = opts[:'read'] if !opts[:'read'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'EmailPreview' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#mark_as_read\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Reply to an email Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. @param email_id [String] ID of the email that should be replied to @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions @param [Hash] opts the optional parameters @return [SentEmailDto]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1595 def reply_to_email(email_id, reply_to_email_options, opts = {}) data, _status_code, _headers = reply_to_email_with_http_info(email_id, reply_to_email_options, opts) data end
Reply to an email Send the reply to the email sender or reply-to and include same subject cc bcc etc. Reply to an email and the contents will be sent with the existing subject to the emails `to`, `cc`, and `bcc`. @param email_id [String] ID of the email that should be replied to @param reply_to_email_options [ReplyToEmailOptions] replyToEmailOptions @param [Hash] opts the optional parameters @return [Array<(SentEmailDto
, Integer, Hash)>] SentEmailDto
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1606 def reply_to_email_with_http_info(email_id, reply_to_email_options, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.reply_to_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.reply_to_email" end # verify the required parameter 'reply_to_email_options' is set if @api_client.config.client_side_validation && reply_to_email_options.nil? fail ArgumentError, "Missing the required parameter 'reply_to_email_options' when calling EmailControllerApi.reply_to_email" end # resource path local_var_path = '/emails/{emailId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(reply_to_email_options) # return_type return_type = opts[:return_type] || 'SentEmailDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#reply_to_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Send email Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. @param [Hash] opts the optional parameters @option opts [String] :inbox_id ID of the inbox you want to send the email from @option opts [Boolean] :use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. @option opts [SendEmailOptions] :send_email_options Options for the email @return [nil]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1666 def send_email_source_optional(opts = {}) send_email_source_optional_with_http_info(opts) nil end
Send email Alias for `InboxController.sendEmail` method - see original method for full details. Sends an email from a given inbox that you have created. If no inbox is supplied a random inbox will be created for you and used to send the email. @param [Hash] opts the optional parameters @option opts [String] :inbox_id ID of the inbox you want to send the email from @option opts [Boolean] :use_domain_pool Use domain pool. Optionally create inbox to send from using the mailslurp domain pool. @option opts [SendEmailOptions] :send_email_options Options for the email @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1678 def send_email_source_optional_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.send_email_source_optional ...' end # resource path local_var_path = '/emails' # query parameters query_params = opts[:query_params] || {} query_params[:'inboxId'] = opts[:'inbox_id'] if !opts[:'inbox_id'].nil? query_params[:'useDomainPool'] = opts[:'use_domain_pool'] if !opts[:'use_domain_pool'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] || @api_client.object_to_http_body(opts[:'send_email_options']) # return_type return_type = opts[:return_type] # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#send_email_source_optional\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Validate email HTML contents Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [ValidationDto]
# File lib/mailslurp_client/api/email_controller_api.rb, line 1728 def validate_email(email_id, opts = {}) data, _status_code, _headers = validate_email_with_http_info(email_id, opts) data end
Validate email HTML contents Validate the HTML content of email if HTML is found. Considered valid if no HTML is present. @param email_id [String] ID of email @param [Hash] opts the optional parameters @return [Array<(ValidationDto
, Integer, Hash)>] ValidationDto
data, response status code and response headers
# File lib/mailslurp_client/api/email_controller_api.rb, line 1738 def validate_email_with_http_info(email_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EmailControllerApi.validate_email ...' end # verify the required parameter 'email_id' is set if @api_client.config.client_side_validation && email_id.nil? fail ArgumentError, "Missing the required parameter 'email_id' when calling EmailControllerApi.validate_email" end # resource path local_var_path = '/emails/{emailId}/validate'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:body] # return_type return_type = opts[:return_type] || 'ValidationDto' # auth_names auth_names = opts[:auth_names] || ['API_KEY'] new_options = opts.merge( :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: EmailControllerApi#validate_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end