70 lines
1.3 KiB
C
70 lines
1.3 KiB
C
/******************************************************************************
|
|
*
|
|
* 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
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <aisl/aisl.h>
|
|
#include <uuid/uuid.h>
|
|
|
|
|
|
#ifndef AX_MAIL_FORMAT
|
|
|
|
#define AX_MAIL_FORMAT \
|
|
"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;
|
|
const char *to;
|
|
const char *reply_to;
|
|
const char *from;
|
|
const char *subject;
|
|
const char *msg;
|
|
uuid_t msg_id;
|
|
};
|
|
|
|
typedef struct ax_mail * AxMail;
|
|
|
|
|
|
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);
|
|
|
|
|
|
AislStatus
|
|
ax_mail_get_status(AxMail mail);
|
|
|
|
|
|
#endif /* !MAIL_H */
|