Uniconta API’s (Email, Report, Utility)

Date: 2021-06-25

EmailAPI

static async Task SendMail(CrudAPI api, string subject, string message)
{
	api.ForcePrimarySQL = true;
	var to = "";
	var emailApi = new EmailAPI(api);
	var mailContent = new EmailAPI.EmailContent() {
		To = to,
		Subject = subject,
		Body = message.Replace(Environment.NewLine, $"<br>{Environment.NewLine}"),
		BodyIsHtml = true
	};

	var smtpClient = await api.Query<CompanySMTPClient>();
	var defaultClient = smtpClient.FirstOrDefault(x => x.Default);
	if (defaultClient == null) return;
	await emailApi.Send(defaultClient.KeyStr, mailContent);
}
51490cookie-checkUniconta API’s (Email, Report, Utility)