Class: MailSlurpClient::EmailControllerApi

Inherits:
Object
  • Object
show all
Defined in:
lib/mailslurp_client/api/email_controller_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ EmailControllerApi

Returns a new instance of EmailControllerApi.



19
20
21
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#apply_imap_flag_operation(email_id, imap_flag_operation_options, opts = {}) ⇒ EmailPreview

Set IMAP flags associated with a message. Only supports '\Seen' flag. Apply RFC3501 section-2.3.2 IMAP flag operations on an email

Parameters:

  • email_id (String)
  • imap_flag_operation_options (ImapFlagOperationOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



28
29
30
31
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 28

def apply_imap_flag_operation(email_id, imap_flag_operation_options, opts = {})
  data, _status_code, _headers = apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts)
  data
end

#apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts = {}) ⇒ Array<(EmailPreview, Integer, Hash)>

Set IMAP flags associated with a message. Only supports &#39;\Seen&#39; flag. Apply RFC3501 section-2.3.2 IMAP flag operations on an email

Parameters:

  • email_id (String)
  • imap_flag_operation_options (ImapFlagOperationOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EmailPreview, Integer, Hash)>)

    EmailPreview data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 39

def apply_imap_flag_operation_with_http_info(email_id, imap_flag_operation_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.apply_imap_flag_operation ...'
  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.apply_imap_flag_operation"
  end
  # verify the required parameter 'imap_flag_operation_options' is set
  if @api_client.config.client_side_validation && imap_flag_operation_options.nil?
    fail ArgumentError, "Missing the required parameter 'imap_flag_operation_options' when calling EmailControllerApi.apply_imap_flag_operation"
  end
  # resource path
  local_var_path = '/emails/{emailId}/imap-flag-operation'.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(['*/*'])
  # 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(imap_flag_operation_options) 

  # 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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: EmailControllerApi#apply_imap_flag_operation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_all_emails(opts = {}) ⇒ nil

Delete all emails in all inboxes. Deletes all emails in your account. Be careful as emails cannot be recovered

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


96
97
98
99
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 96

def delete_all_emails(opts = {})
  delete_all_emails_with_http_info(opts)
  nil
end

#delete_all_emails_with_http_info(opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete all emails in all inboxes. Deletes all emails in your account. Be careful as emails cannot be recovered

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 105

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_email(email_id, opts = {}) ⇒ nil

Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.

Parameters:

  • email_id (String)

    ID of email to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


151
152
153
154
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 151

def delete_email(email_id, opts = {})
  delete_email_with_http_info(email_id, opts)
  nil
end

#delete_email_with_http_info(email_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete an email Deletes an email and removes it from the inbox. Deleted emails cannot be recovered.

Parameters:

  • email_id (String)

    ID of email to delete

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 161

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

#download_attachment(email_id, attachment_id, opts = {}) ⇒ String

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.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    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.

Returns:

  • (String)


213
214
215
216
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 213

def download_attachment(email_id, attachment_id, opts = {})
  data, _status_code, _headers = download_attachment_with_http_info(email_id, attachment_id, opts)
  data
end

#download_attachment_base64(email_id, attachment_id, opts = {}) ⇒ DownloadAttachmentDto

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.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



283
284
285
286
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 283

def download_attachment_base64(email_id, attachment_id, opts = {})
  data, _status_code, _headers = download_attachment_base64_with_http_info(email_id, attachment_id, opts)
  data
end

#download_attachment_base64_with_http_info(email_id, attachment_id, opts = {}) ⇒ Array<(DownloadAttachmentDto, Integer, Hash)>

Get email attachment as base64 encoded string as an alternative to binary responses. Decode the &#x60;base64FileContents&#x60; as a &#x60;utf-8&#x60; encoded string or array of bytes depending on the &#x60;contentType&#x60;. 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 &#x60;downloadAttachment&#x60; method but allows some clients to get around issues with binary responses.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(DownloadAttachmentDto, Integer, Hash)>)

    DownloadAttachmentDto data, response status code and response headers



294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 294

def download_attachment_base64_with_http_info(email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}/base64'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_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(['*/*'])

  # 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

#download_attachment_with_http_info(email_id, attachment_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get email attachment bytes. Returned as &#x60;octet-stream&#x60; with content type header. If you have trouble with byte responses try the &#x60;downloadAttachmentBase64&#x60; 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.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :api_key (String)

    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.

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 225

def download_attachment_with_http_info(email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_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

#download_body(email_id, opts = {}) ⇒ String

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

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


350
351
352
353
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 350

def download_body(email_id, opts = {})
  data, _status_code, _headers = download_body_with_http_info(email_id, opts)
  data
end

#download_body_bytes(email_id, opts = {}) ⇒ String

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.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


412
413
414
415
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 412

def download_body_bytes(email_id, opts = {})
  data, _status_code, _headers = download_body_bytes_with_http_info(email_id, opts)
  data
end

#download_body_bytes_with_http_info(email_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get email body in bytes. Returned as &#x60;octet-stream&#x60; with content type header. Returns the specified email body for a given email as a stream / array of bytes.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 422

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

#download_body_with_http_info(email_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Get email body as string. Returned as &#x60;plain/text&#x60; with content type header. Returns the specified email body for a given email as a string

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 360

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/plain', '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#download_body\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#forward_email(email_id, forward_email_options, opts = {}) ⇒ SentEmailDto

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.

Parameters:

  • email_id (String)

    ID of email

  • forward_email_options (ForwardEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



475
476
477
478
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 475

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_with_http_info(email_id, forward_email_options, opts = {}) ⇒ Array<(SentEmailDto, Integer, Hash)>

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 &#x60;from&#x60; 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.

Parameters:

  • email_id (String)

    ID of email

  • forward_email_options (ForwardEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SentEmailDto, Integer, Hash)>)

    SentEmailDto data, response status code and response headers



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 486

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(['*/*'])
  # 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_attachment_meta_data(email_id, attachment_id, opts = {}) ⇒ AttachmentMetaData

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.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



545
546
547
548
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 545

def (email_id, attachment_id, opts = {})
  data, _status_code, _headers = (email_id, attachment_id, opts)
  data
end

#get_attachment_meta_data_with_http_info(email_id, attachment_id, opts = {}) ⇒ Array<(AttachmentMetaData, Integer, Hash)>

Get email attachment metadata. This is the &#x60;contentType&#x60; and &#x60;contentLength&#x60; of an attachment. To get the individual attachments use the &#x60;downloadAttachment&#x60; methods. Returns the metadata such as name and content-type for a given attachment and email.

Parameters:

  • email_id (String)

    ID of email

  • attachment_id (String)

    ID of attachment

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(AttachmentMetaData, Integer, Hash)>)

    AttachmentMetaData data, response status code and response headers



556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 556

def (email_id, attachment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: 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
  # 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
  # resource path
  local_var_path = '/emails/{emailId}/attachments/{attachmentId}/metadata'.sub('{' + 'emailId' + '}', CGI.escape(email_id.to_s)).sub('{' + 'attachmentId' + '}', CGI.escape(attachment_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(['*/*'])

  # 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_email(email_id, opts = {}) ⇒ Email

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

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing (default to false)

Returns:



613
614
615
616
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 613

def get_email(email_id, opts = {})
  data, _status_code, _headers = get_email_with_http_info(email_id, opts)
  data
end

#get_email_attachments(email_id, opts = {}) ⇒ Array<AttachmentMetaData>

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.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



677
678
679
680
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 677

def get_email_attachments(email_id, opts = {})
  data, _status_code, _headers = get_email_attachments_with_http_info(email_id, opts)
  data
end

#get_email_attachments_with_http_info(email_id, opts = {}) ⇒ Array<(Array<AttachmentMetaData>, Integer, Hash)>

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.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Array<AttachmentMetaData>, Integer, Hash)>)

    Array<AttachmentMetaData> data, response status code and response headers



687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 687

def get_email_attachments_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_attachments ...'
  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_attachments"
  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(['*/*'])

  # 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_email_attachments\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_content_match(email_id, content_match_options, opts = {}) ⇒ EmailContentMatchResult

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: (\d6)`. 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.

Parameters:

  • email_id (String)

    ID of email to match against

  • content_match_options (ContentMatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



740
741
742
743
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 740

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_match_with_http_info(email_id, content_match_options, opts = {}) ⇒ Array<(EmailContentMatchResult, Integer, Hash)>

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 &#x60;/&#x60; at start or end of regex in some languages. Given an example &#x60;your code is: 12345&#x60; the pattern to extract match looks like &#x60;code is: (\d6)&#x60;. This will return an array of matches with the first matching the entire pattern and the subsequent matching the groups: &#x60;[&#39;code is: 123456&#39;, &#39;123456&#39;]&#x60; See docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html for more information of available patterns.

Parameters:

  • email_id (String)

    ID of email to match against

  • content_match_options (ContentMatchOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EmailContentMatchResult, Integer, Hash)>)

    EmailContentMatchResult data, response status code and response headers



751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 751

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(['*/*'])
  # 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_count(opts = {}) ⇒ CountDto

Get email count

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



807
808
809
810
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 807

def get_email_count(opts = {})
  data, _status_code, _headers = get_email_count_with_http_info(opts)
  data
end

#get_email_count_with_http_info(opts = {}) ⇒ Array<(CountDto, Integer, Hash)>

Get email count

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(CountDto, Integer, Hash)>)

    CountDto data, response status code and response headers



815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 815

def get_email_count_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_count ...'
  end
  # resource path
  local_var_path = '/emails/emails/count'

  # 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(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'CountDto' 

  # 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_count\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_html(email_id, opts = {}) ⇒ String

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`. Returns content-type `text/html;charset=utf-8` so you must call expecting that content response not JSON. For JSON response see the `getEmailHTMLJson` method.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean) — default: default to false

Returns:

  • (String)


864
865
866
867
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 864

def get_email_html(email_id, opts = {})
  data, _status_code, _headers = get_email_html_with_http_info(email_id, opts)
  data
end

#get_email_html_json(email_id, opts = {}) ⇒ EmailHtmlDto

Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content Retrieve email content as HTML response. Decodes quoted-printable entities and converts charset to UTF-8. Returns content-type `application/json;charset=utf-8` so you must call expecting that content response not JSON.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean) — default: default to false

Returns:



929
930
931
932
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 929

def get_email_html_json(email_id, opts = {})
  data, _status_code, _headers = get_email_html_json_with_http_info(email_id, opts)
  data
end

#get_email_html_json_with_http_info(email_id, opts = {}) ⇒ Array<(EmailHtmlDto, Integer, Hash)>

Get email content as HTML in JSON wrapper. For fetching entity decoded HTML content Retrieve email content as HTML response. Decodes quoted-printable entities and converts charset to UTF-8. Returns content-type &#x60;application/json;charset&#x3D;utf-8&#x60; so you must call expecting that content response not JSON.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

Returns:

  • (Array<(EmailHtmlDto, Integer, Hash)>)

    EmailHtmlDto data, response status code and response headers



940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 940

def get_email_html_json_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_html_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_email_html_json"
  end
  # resource path
  local_var_path = '/emails/{emailId}/html/json'.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(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'EmailHtmlDto' 

  # 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_json\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_html_query(email_id, html_selector, opts = {}) ⇒ EmailTextLinesResult

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

Parameters:

  • email_id (String)

    ID of email to perform HTML query on

  • html_selector (String)

    HTML selector to search for. Uses JQuery/JSoup/CSS style selector like &#39;.my-div&#39; to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



994
995
996
997
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 994

def get_email_html_query(email_id, html_selector, opts = {})
  data, _status_code, _headers = get_email_html_query_with_http_info(email_id, html_selector, opts)
  data
end

#get_email_html_query_with_http_info(email_id, html_selector, opts = {}) ⇒ Array<(EmailTextLinesResult, Integer, Hash)>

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

Parameters:

  • email_id (String)

    ID of email to perform HTML query on

  • html_selector (String)

    HTML selector to search for. Uses JQuery/JSoup/CSS style selector like &#39;.my-div&#39; to match content. See jsoup.org/apidocs/org/jsoup/select/Selector.html for more information.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EmailTextLinesResult, Integer, Hash)>)

    EmailTextLinesResult data, response status code and response headers



1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1005

def get_email_html_query_with_http_info(email_id, html_selector, 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
  # verify the required parameter 'html_selector' is set
  if @api_client.config.client_side_validation && html_selector.nil?
    fail ArgumentError, "Missing the required parameter 'html_selector' 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'] = html_selector

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # 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_html_with_http_info(email_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

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: &#x60;?apiKey&#x3D;xxx&#x60;. Returns content-type &#x60;text/html;charset&#x3D;utf-8&#x60; so you must call expecting that content response not JSON. For JSON response see the &#x60;getEmailHTMLJson&#x60; method.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 875

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;charset=utf-8', '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

Parameters:

  • email_id (String)

    ID of email to fetch text for

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1062
1063
1064
1065
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1062

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

Parameters:

  • email_id (String)

    ID of email to fetch text for

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EmailLinksResult, Integer, Hash)>)

    EmailLinksResult data, response status code and response headers



1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1072

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(['*/*'])

  # 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

#get_email_preview_ur_ls(email_id, opts = {}) ⇒ EmailPreviewUrls

Get email URLs for viewing in browser or downloading Get a list of URLs for email content as text/html or raw SMTP message for viewing the message in a browser.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1124
1125
1126
1127
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1124

def get_email_preview_ur_ls(email_id, opts = {})
  data, _status_code, _headers = get_email_preview_ur_ls_with_http_info(email_id, opts)
  data
end

#get_email_preview_ur_ls_with_http_info(email_id, opts = {}) ⇒ Array<(EmailPreviewUrls, Integer, Hash)>

Get email URLs for viewing in browser or downloading Get a list of URLs for email content as text/html or raw SMTP message for viewing the message in a browser.

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(EmailPreviewUrls, Integer, Hash)>)

    EmailPreviewUrls data, response status code and response headers



1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1134

def get_email_preview_ur_ls_with_http_info(email_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_email_preview_ur_ls ...'
  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_preview_ur_ls"
  end
  # resource path
  local_var_path = '/emails/{emailId}/urls'.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(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'EmailPreviewUrls' 

  # 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_preview_ur_ls\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_email_text_lines(email_id, opts = {}) ⇒ EmailTextLinesResult

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.

Parameters:

  • email_id (String)

    ID of email to fetch text for

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode_html_entities (Boolean)

    Decode HTML entities

  • :line_separator (String)

    Line separator character

Returns:



1188
1189
1190
1191
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1188

def get_email_text_lines(email_id, opts = {})
  data, _status_code, _headers = get_email_text_lines_with_http_info(email_id, opts)
  data
end

#get_email_text_lines_with_http_info(email_id, opts = {}) ⇒ Array<(EmailTextLinesResult, Integer, Hash)>

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.

Parameters:

  • email_id (String)

    ID of email to fetch text for

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode_html_entities (Boolean)

    Decode HTML entities

  • :line_separator (String)

    Line separator character

Returns:

  • (Array<(EmailTextLinesResult, Integer, Hash)>)

    EmailTextLinesResult data, response status code and response headers



1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1200

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(['*/*'])

  # 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_with_http_info(email_id, opts = {}) ⇒ Array<(Email, Integer, Hash)>

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

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :decode (Boolean)

    Decode email body quoted-printable encoding to plain text. SMTP servers often encode text using quoted-printable format (for instance &#x60;&#x3D;D7&#x60;). This can be a pain for testing

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 624

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(['*/*'])

  # 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_emails_paginated(opts = {}) ⇒ PageEmailProjection

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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination (default to 0)

  • :size (Integer)

    Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20)

  • :sort (String)

    Optional createdAt sort direction ASC or DESC (default to 'ASC')

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false)

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:



1261
1262
1263
1264
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1261

def get_emails_paginated(opts = {})
  data, _status_code, _headers = get_emails_paginated_with_http_info(opts)
  data
end

#get_emails_paginated_with_http_info(opts = {}) ⇒ Array<(PageEmailProjection, Integer, Hash)>

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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination

  • :size (Integer)

    Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

  • :search_filter (String)

    Optional search filter. Searches email recipients, sender, subject, email address and ID. Does not search email body

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:

  • (Array<(PageEmailProjection, Integer, Hash)>)

    PageEmailProjection data, response status code and response headers



1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1278

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
  if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"size"]" when calling EmailControllerApi.get_emails_paginated, must be smaller than or equal to 100.'
  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[:'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[:'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?
  query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # 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(email_address, opts = {}) ⇒ GravatarUrl

Get gravatar url for email address

Parameters:

  • email_address (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :size (String)

Returns:



1342
1343
1344
1345
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1342

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_with_http_info(email_address, opts = {}) ⇒ Array<(GravatarUrl, Integer, Hash)>

Get gravatar url for email address

Parameters:

  • email_address (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :size (String)

Returns:

  • (Array<(GravatarUrl, Integer, Hash)>)

    GravatarUrl data, response status code and response headers



1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1352

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(['*/*'])

  # 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(opts = {}) ⇒ Email

Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_ids (Array<String>)

    Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes

Returns:



1406
1407
1408
1409
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1406

def get_latest_email(opts = {})
  data, _status_code, _headers = get_latest_email_with_http_info(opts)
  data
end

#get_latest_email_in_inbox1(inbox_id, opts = {}) ⇒ Email

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

Parameters:

  • inbox_id (String)

    ID of the inbox you want to get the latest email from

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1465
1466
1467
1468
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1465

def get_latest_email_in_inbox1(inbox_id, opts = {})
  data, _status_code, _headers = get_latest_email_in_inbox1_with_http_info(inbox_id, opts)
  data
end

#get_latest_email_in_inbox1_with_http_info(inbox_id, opts = {}) ⇒ Array<(Email, Integer, Hash)>

Get latest email in an inbox. Use &#x60;WaitForController&#x60; to get emails that may not have arrived yet. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

  • inbox_id (String)

    ID of the inbox you want to get the latest email from

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1475

def get_latest_email_in_inbox1_with_http_info(inbox_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.get_latest_email_in_inbox1 ...'
  end
  # verify the required parameter 'inbox_id' is set
  if @api_client.config.client_side_validation && inbox_id.nil?
    fail ArgumentError, "Missing the required parameter 'inbox_id' when calling EmailControllerApi.get_latest_email_in_inbox1"
  end
  # resource path
  local_var_path = '/emails/latestIn'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'inboxId'] = inbox_id

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # 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_inbox1\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_latest_email_with_http_info(opts = {}) ⇒ Array<(Email, Integer, Hash)>

Get latest email in all inboxes. Most recently received. Get the newest email in all inboxes or in a passed set of inbox IDs

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_ids (Array<String>)

    Optional set of inboxes to filter by. Only get the latest email from these inbox IDs. If not provided will search across all inboxes

Returns:

  • (Array<(Email, Integer, Hash)>)

    Email data, response status code and response headers



1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1416

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(['*/*'])

  # 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_organization_emails_paginated(opts = {}) ⇒ PageEmailProjection

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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination (default to 0)

  • :size (Integer)

    Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results (default to 20)

  • :sort (String)

    Optional createdAt sort direction ASC or DESC (default to 'ASC')

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly (default to false)

  • :search_filter (String)

    Optional search filter search filter for emails.

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:



1535
1536
1537
1538
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1535

def get_organization_emails_paginated(opts = {})
  data, _status_code, _headers = get_organization_emails_paginated_with_http_info(opts)
  data
end

#get_organization_emails_paginated_with_http_info(opts = {}) ⇒ Array<(PageEmailProjection, Integer, Hash)>

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

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (Array<String>)

    Optional inbox ids to filter by. Can be repeated. By default will use all inboxes belonging to your account.

  • :page (Integer)

    Optional page index in email list pagination

  • :size (Integer)

    Optional page size in email list pagination. Maximum size is 100. Use page index and sort to page through larger results

  • :sort (String)

    Optional createdAt sort direction ASC or DESC

  • :unread_only (Boolean)

    Optional filter for unread emails only. All emails are considered unread until they are viewed in the dashboard or requested directly

  • :search_filter (String)

    Optional search filter search filter for emails.

  • :since (DateTime)

    Optional filter emails received after given date time

  • :before (DateTime)

    Optional filter emails received before given date time

Returns:

  • (Array<(PageEmailProjection, Integer, Hash)>)

    PageEmailProjection data, response status code and response headers



1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1552

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
  if @api_client.config.client_side_validation && !opts[:'size'].nil? && opts[:'size'] > 100
    fail ArgumentError, 'invalid value for "opts[:"size"]" when calling EmailControllerApi.get_organization_emails_paginated, must be smaller than or equal to 100.'
  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[:'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[:'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?
  query_params[:'searchFilter'] = opts[:'search_filter'] if !opts[:'search_filter'].nil?
  query_params[:'since'] = opts[:'since'] if !opts[:'since'].nil?
  query_params[:'before'] = opts[:'before'] if !opts[:'before'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # 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_contents(email_id, opts = {}) ⇒ String

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

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (String)


1616
1617
1618
1619
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1616

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_contents_with_http_info(email_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

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

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(String, Integer, Hash)>)

    String data, response status code and response headers



1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1626

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_json(email_id, opts = {}) ⇒ RawEmailJson

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

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1678
1679
1680
1681
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1678

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_json_with_http_info(email_id, opts = {}) ⇒ Array<(RawEmailJson, Integer, Hash)>

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

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(RawEmailJson, Integer, Hash)>)

    RawEmailJson data, response status code and response headers



1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1688

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(['*/*'])

  # 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(opts = {}) ⇒ UnreadCount

Get unread email count Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1739
1740
1741
1742
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1739

def get_unread_email_count(opts = {})
  data, _status_code, _headers = get_unread_email_count_with_http_info(opts)
  data
end

#get_unread_email_count_with_http_info(opts = {}) ⇒ Array<(UnreadCount, Integer, Hash)>

Get unread email count Get number of emails unread. Unread means has not been viewed in dashboard or returned in an email API response

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(UnreadCount, Integer, Hash)>)

    UnreadCount data, response status code and response headers



1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1748

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(['*/*'])

  # 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_as_read(email_id, opts = {}) ⇒ EmailPreview

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

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true. (default to true)

Returns:



1797
1798
1799
1800
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1797

def mark_as_read(email_id, opts = {})
  data, _status_code, _headers = mark_as_read_with_http_info(email_id, opts)
  data
end

#mark_as_read_with_http_info(email_id, opts = {}) ⇒ Array<(EmailPreview, Integer, Hash)>

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

Parameters:

  • email_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :read (Boolean)

    What value to assign to email read property. Default true.

Returns:

  • (Array<(EmailPreview, Integer, Hash)>)

    EmailPreview data, response status code and response headers



1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1808

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(['*/*'])

  # 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_email(email_id, reply_to_email_options, opts = {}) ⇒ SentEmailDto

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`.

Parameters:

  • email_id (String)

    ID of the email that should be replied to

  • reply_to_email_options (ReplyToEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



1862
1863
1864
1865
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1862

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_email_with_http_info(email_id, reply_to_email_options, opts = {}) ⇒ Array<(SentEmailDto, Integer, Hash)>

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 &#x60;to&#x60;, &#x60;cc&#x60;, and &#x60;bcc&#x60;.

Parameters:

  • email_id (String)

    ID of the email that should be replied to

  • reply_to_email_options (ReplyToEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SentEmailDto, Integer, Hash)>)

    SentEmailDto data, response status code and response headers



1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1873

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(['*/*'])
  # 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_source_optional(send_email_options, opts = {}) ⇒ nil

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.

Parameters:

  • send_email_options (SendEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    ID of the inbox you want to send the email from

  • :use_domain_pool (Boolean)

    Use domain pool. Optionally create inbox to send from using the mailslurp domain pool.

  • :virtual_send (Boolean)

    Optionally create inbox to send from that is a virtual inbox and won&#39;t send to external addresses

Returns:

  • (nil)


1934
1935
1936
1937
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1934

def send_email_source_optional(send_email_options, opts = {})
  send_email_source_optional_with_http_info(send_email_options, opts)
  nil
end

#send_email_source_optional_with_http_info(send_email_options, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Send email Alias for &#x60;InboxController.sendEmail&#x60; 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.

Parameters:

  • send_email_options (SendEmailOptions)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :inbox_id (String)

    ID of the inbox you want to send the email from

  • :use_domain_pool (Boolean)

    Use domain pool. Optionally create inbox to send from using the mailslurp domain pool.

  • :virtual_send (Boolean)

    Optionally create inbox to send from that is a virtual inbox and won&#39;t send to external addresses

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 1947

def send_email_source_optional_with_http_info(send_email_options, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: EmailControllerApi.send_email_source_optional ...'
  end
  # verify the required parameter 'send_email_options' is set
  if @api_client.config.client_side_validation && send_email_options.nil?
    fail ArgumentError, "Missing the required parameter 'send_email_options' when calling 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?
  query_params[:'virtualSend'] = opts[:'virtual_send'] if !opts[:'virtual_send'].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(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(email_id, opts = {}) ⇒ ValidationDto

Validate email HTML contents Validate the HTML content of email if HTML is found. Considered valid if no HTML is present.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



2002
2003
2004
2005
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2002

def validate_email(email_id, opts = {})
  data, _status_code, _headers = validate_email_with_http_info(email_id, opts)
  data
end

#validate_email_with_http_info(email_id, opts = {}) ⇒ Array<(ValidationDto, Integer, Hash)>

Validate email HTML contents Validate the HTML content of email if HTML is found. Considered valid if no HTML is present.

Parameters:

  • email_id (String)

    ID of email

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(ValidationDto, Integer, Hash)>)

    ValidationDto data, response status code and response headers



2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
# File 'lib/mailslurp_client/api/email_controller_api.rb', line 2012

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(['*/*'])

  # 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