aisl-sdk/components/mail.h

70 lines
1.3 KiB
C
Raw Normal View History

2019-04-16 14:26:37 +02:00
/******************************************************************************
*
* Copyright (c) 2017-2019 by Löwenware Ltd
* Please, refer LICENSE file for legal information
*
******************************************************************************/
/**
* @file mail.h
* @author Ilja Kartašov <ik@lowenware.com>
* @brief Mail sending component header file
*
* @see https://lowenware.com/aisl/
*/
#ifndef MAIL_H_2738BEC4_CF82_4D77_A41F_0E2615848194
#define MAIL_H_2738BEC4_CF82_4D77_A41F_0E2615848194
2019-04-16 14:26:37 +02:00
#include <pthread.h>
#include <aisl/aisl.h>
#include <uuid/uuid.h>
#ifndef AX_MAIL_FORMAT
2019-04-16 14:26:37 +02:00
#define AX_MAIL_FORMAT \
2019-04-16 14:26:37 +02:00
"Date: %s\r\n" \
"To: %s\r\n" \
"From: %s\r\n" \
"Reply-To: %s\r\n" \
"Message-ID: %s\r\n" \
"Subject: %s\r\n" \
"\r\n" \
"%s" \
"\r\n" \
#endif
struct ax_mail {
pthread_t thread;
2019-04-16 14:26:37 +02:00
const char *to;
const char *reply_to;
2019-04-16 14:26:37 +02:00
const char *from;
const char *subject;
const char *msg;
uuid_t msg_id;
};
typedef struct ax_mail * AxMail;
2019-04-16 14:26:37 +02:00
struct ax_mail_smtp {
const char *user;
const char *pass;
const char *host;
uint16_t port;
};
AislStatus
ax_mail_send(AxMail mail, struct ax_mail_smtp *smtp, int flags);
2019-04-16 14:26:37 +02:00
AislStatus
ax_mail_get_status(AxMail mail);
2019-04-16 14:26:37 +02:00
#endif /* !MAIL_H */