39 lines
1.2 KiB
C
39 lines
1.2 KiB
C
/* mail_engine.h - IMAP fetching & SMTP fan-out engine using libcurl */
|
|
#ifndef __MAIL_ENGINE_H__
|
|
#define __MAIL_ENGINE_H__
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <ilib/configuration.h>
|
|
|
|
typedef struct mail_message {
|
|
char *raw_data; /* Full raw RFC 822 byte payload */
|
|
size_t size; /* Size of raw payload */
|
|
unsigned long uid; /* IMAP Unique Identifier */
|
|
} mail_message_t;
|
|
|
|
typedef struct mail_list_results {
|
|
unsigned long *uids;
|
|
size_t count;
|
|
} mail_list_results_t;
|
|
|
|
/* Initialize and cleanup global libcurl environment */
|
|
int mail_engine_global_init(void);
|
|
void mail_engine_global_cleanup(void);
|
|
|
|
/* IMAP Client API */
|
|
int imap_fetch_unseen_uids(const subrelay_config_t *cfg, mail_list_results_t *results);
|
|
int imap_fetch_message(const subrelay_config_t *cfg, unsigned long uid, mail_message_t *msg);
|
|
int imap_expunge_message(const subrelay_config_t *cfg, unsigned long uid);
|
|
void mail_message_free(mail_message_t *msg);
|
|
void mail_list_results_free(mail_list_results_t *res);
|
|
|
|
/* SMTP Client API */
|
|
int smtp_send_message(const subrelay_config_t *cfg,
|
|
const char **recipients,
|
|
size_t recipient_count,
|
|
const char *raw_msg,
|
|
size_t msg_len);
|
|
|
|
#endif /* __MAIL_ENGINE_H__ */
|