postMailSend method

Future<RestApiResponse> postMailSend({
  1. String uuid = '',
  2. String oid = '',
  3. String from = '-',
  4. List<String>? to,
  5. List<String>? cc,
  6. List<String>? bcc,
  7. String name = '-',
  8. String description = '-',
  9. String subject = '-',
  10. String htmlContent = '-',
  11. String plainContent = '-',
  12. String template = '',
  13. Map<String, dynamic>? templateData,
  14. List<Map<String, dynamic>>? attachments,
  15. int priorityValue = 3,
  16. String priorityText = 'normal',
  17. bool convertImageDataSrcToFileSrc = false,
  18. bool acknowledgementRequired = false,
  19. bool keepCalendar = false,
  20. bool sendAssignReceiver = false,
  21. DateTime? startTime,
  22. String action = '',
  23. String actions = '',
})

This request allows to update existing email and send it (when body does not contain any OID a new mail is beeing created)

Hinweis zur neuen API: Aktualisiert eine E-Mail und versendet sie (POST v1/mail/send); ohne OID im Body wird eine neue Mail erstellt.

Implementation

Future<RestApiResponse> postMailSend({
  String uuid = '',
  String oid = '',
  String from = '-',
  List<String>? to,
  List<String>? cc,
  List<String>? bcc,
  String name = '-',
  String description = '-',
  String subject = '-',
  String htmlContent = '-',
  String plainContent = '-',
  String template = '',
  Map<String, dynamic>? templateData,
  List<Map<String, dynamic>>? attachments,
  int priorityValue = 3,
  String priorityText = 'normal',
  bool convertImageDataSrcToFileSrc = false,
  bool acknowledgementRequired = false,
  bool keepCalendar = false,
  bool sendAssignReceiver = false,
  DateTime? startTime,
  String action = '',
  String actions = '',
}) {
  final Map<String, String> query = <String, String>{};
  if (action.isNotEmpty) query['action'] = action;
  if (actions.isNotEmpty) query['actions'] = actions;

  final Map<String, dynamic> body = <String, dynamic>{
    '~UUID': uuid,
    '~ObjectID': oid,
    'from': from,
  };
  if (to != null) body['to'] = to;
  if (cc != null) body['cc'] = cc;
  if (bcc != null) body['bcc'] = bcc;
  body['name'] = name;
  body['description'] = description;
  body['subject'] = subject;
  body['htmlContent'] = htmlContent;
  body['plainContent'] = plainContent;
  if (template != '') body['template'] = template;
  if (templateData != null) body['templateData'] = templateData;
  if (attachments != null) body['attachments'] = attachments;
  body['acknowledgementRequired'] = acknowledgementRequired;
  body['convertImageDataSrcToFileSrc'] = convertImageDataSrcToFileSrc;
  body['keepCalendar'] = keepCalendar;
  body['sendAssignReceiver'] = sendAssignReceiver;
  if (startTime != null) body['startTime'] = startTime.toISOFormatString();
  body['priority'] = _priority(priorityValue, priorityText);

  return _execute(
    method: ApiHttpMethod.post,
    path: '/mail/send',
    queryParameters: query,
    body: jsonEncode(body),
    operation: 'postMailSend',
  );
}