|
@@ -3976,6 +3976,7 @@ smtp_attachment_clear_all(struct smtp *const smtp){
|
|
|
#include "thread.h"
|
|
#include "thread.h"
|
|
|
#include "xlist.h"
|
|
#include "xlist.h"
|
|
|
#include "elog.h"
|
|
#include "elog.h"
|
|
|
|
|
+#include "lock.h"
|
|
|
#include "sqlite_handle.h"
|
|
#include "sqlite_handle.h"
|
|
|
|
|
|
|
|
#if 1
|
|
#if 1
|
|
@@ -3992,112 +3993,93 @@ smtp_attachment_clear_all(struct smtp *const smtp){
|
|
|
#define MAIL_FLAGS (SMTP_DEBUG|SMTP_NO_CERT_VERIFY) /* Do not verify cert. */
|
|
#define MAIL_FLAGS (SMTP_DEBUG|SMTP_NO_CERT_VERIFY) /* Do not verify cert. */
|
|
|
#define MAIL_CAFILE NULL
|
|
#define MAIL_CAFILE NULL
|
|
|
#define MAIL_AUTH SMTP_AUTH_PLAIN
|
|
#define MAIL_AUTH SMTP_AUTH_PLAIN
|
|
|
|
|
+static int send_mail(smtp_send_t *send, void *addr, char *sub, char *body, int multi)
|
|
|
|
|
+{
|
|
|
|
|
+ int i,r=-1,flag=0;
|
|
|
|
|
+ struct smtp *smtp=NULL;
|
|
|
|
|
+ enum smtp_flag flags=(SMTP_DEBUG|SMTP_NO_CERT_VERIFY);
|
|
|
|
|
+ enum smtp_connection_security security=SMTP_SECURITY_STARTTLS;
|
|
|
|
|
+ enum smtp_authentication_method auth=SMTP_AUTH_PLAIN;
|
|
|
|
|
|
|
|
|
|
+ lock_s_hold(LOCK_ID_SMTP);
|
|
|
|
|
+ if(!sub || !body || send->mode==0) {
|
|
|
|
|
+ goto out;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-typedef struct {
|
|
|
|
|
- char server[64];
|
|
|
|
|
- char port[10];
|
|
|
|
|
-
|
|
|
|
|
- char user[32];
|
|
|
|
|
- char passwd[32];
|
|
|
|
|
-
|
|
|
|
|
- char name_fr[64];
|
|
|
|
|
- char mail_fr[64];
|
|
|
|
|
-
|
|
|
|
|
- char name_to[64];
|
|
|
|
|
- char mail_to[64];
|
|
|
|
|
-
|
|
|
|
|
- char *sub;
|
|
|
|
|
- char *body;
|
|
|
|
|
-}smtp_para_t;
|
|
|
|
|
-static int send_mail(smtp_para_t *para, enum smtp_authentication_method auth)
|
|
|
|
|
-{
|
|
|
|
|
- int r;
|
|
|
|
|
- struct smtp *smtp;
|
|
|
|
|
|
|
+ if(strcmp(send->auth, "LOGIN")==0) {
|
|
|
|
|
+ auth = SMTP_AUTH_LOGIN;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(strcmp(send->auth, "CRAM-MD5")==0) {
|
|
|
|
|
+ auth = SMTP_AUTH_CRAM_MD5;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if(strcmp(send->port,"465")==0) {
|
|
|
|
|
+ security = SMTP_SECURITY_TLS;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- r = smtp_open(para->server, para->port, MAIL_CONNECTION_SECURITY, MAIL_FLAGS, MAIL_CAFILE, &smtp);
|
|
|
|
|
|
|
+ r = smtp_open(send->server, send->port, security, flags, NULL, &smtp);
|
|
|
if(r != SMTP_STATUS_OK) {
|
|
if(r != SMTP_STATUS_OK) {
|
|
|
- LOGE("___ smtp_auth failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
|
|
+ LOGE("___ smtp_open failed, %s\n", smtp_status_code_errstr(r));
|
|
|
return -1;
|
|
return -1;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- r = smtp_auth(smtp, auth, para->user, para->passwd);
|
|
|
|
|
|
|
+ r = smtp_auth(smtp, auth, send->account, send->password);
|
|
|
if(r != SMTP_STATUS_OK) {
|
|
if(r != SMTP_STATUS_OK) {
|
|
|
LOGE("___ smtp_auth failed, %s\n", smtp_status_code_errstr(r));
|
|
LOGE("___ smtp_auth failed, %s\n", smtp_status_code_errstr(r));
|
|
|
goto quit;
|
|
goto quit;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- r = smtp_address_add(smtp, SMTP_ADDRESS_FROM, para->mail_fr, para->name_fr);
|
|
|
|
|
|
|
+ r = smtp_address_add(smtp, SMTP_ADDRESS_FROM, send->account, send->account);
|
|
|
if(r != SMTP_STATUS_OK) {
|
|
if(r != SMTP_STATUS_OK) {
|
|
|
LOGE("___ smtp_address_add fr failed\n, %s", smtp_status_code_errstr(r));
|
|
LOGE("___ smtp_address_add fr failed\n, %s", smtp_status_code_errstr(r));
|
|
|
goto quit;
|
|
goto quit;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- r = smtp_address_add(smtp, SMTP_ADDRESS_TO, para->mail_to, para->name_to);
|
|
|
|
|
- if(r != SMTP_STATUS_OK) {
|
|
|
|
|
- LOGE("___ smtp_address_add to failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
- goto quit;
|
|
|
|
|
|
|
+ if(multi) {
|
|
|
|
|
+ smtp_recv_t *recv=(smtp_recv_t*)addr;
|
|
|
|
|
+ for(i=0; i<SMTP_RECV_MAX; i++) {
|
|
|
|
|
+ if(recv[i].use && strlen(recv[i].account)>0) {
|
|
|
|
|
+ r = smtp_address_add(smtp, SMTP_ADDRESS_TO, recv[i].account, recv[i].account);
|
|
|
|
|
+ if(r != SMTP_STATUS_OK) {
|
|
|
|
|
+ LOGE("___ smtp_address_add to %s failed, %s\n", recv[i].account, smtp_status_code_errstr(r));
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ flag = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- r = smtp_header_add(smtp, "Subject", para->sub);
|
|
|
|
|
- if(r != SMTP_STATUS_OK) {
|
|
|
|
|
- LOGE("___ smtp_header_add failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
- goto quit;
|
|
|
|
|
|
|
+ else {
|
|
|
|
|
+ char *sendto=(char*)addr;
|
|
|
|
|
+ r = smtp_address_add(smtp, SMTP_ADDRESS_TO, sendto, sendto);
|
|
|
|
|
+ if(r != SMTP_STATUS_OK) {
|
|
|
|
|
+ LOGE("___ smtp_address_add to %s failed, %s\n", sendto, smtp_status_code_errstr(r));
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ flag = 1;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //r = smtp_attachment_add_mem(smtp, "test.txt", "Test email attachment.", -1);
|
|
|
|
|
- r = smtp_mail(smtp, para->body);
|
|
|
|
|
- if(r != SMTP_STATUS_OK) {
|
|
|
|
|
- LOGE("___ smtp_mail failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
|
|
+ if(flag>0) {
|
|
|
|
|
+ r = smtp_header_add(smtp, "Subject", sub);
|
|
|
|
|
+ if(r != SMTP_STATUS_OK) {
|
|
|
|
|
+ LOGE("___ smtp_header_add failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
+ goto quit;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //r = smtp_attachment_add_mem(smtp, "test.txt", "Test email attachment.", -1);
|
|
|
|
|
+ smtp_mail(smtp, body);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
quit:
|
|
quit:
|
|
|
- r = smtp_close(smtp);
|
|
|
|
|
|
|
+ smtp_close(smtp);
|
|
|
if(r != SMTP_STATUS_OK){
|
|
if(r != SMTP_STATUS_OK){
|
|
|
- LOGE("smtp_close failed, %s\n", smtp_status_code_errstr(r));
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- return r;
|
|
|
|
|
-}
|
|
|
|
|
-static int send_mails(smtp_sett_t *sett, char *sub, char *body)
|
|
|
|
|
-{
|
|
|
|
|
- int i,r;
|
|
|
|
|
- smtp_para_t para;
|
|
|
|
|
- smtp_recv_t *recv=NULL;
|
|
|
|
|
- enum smtp_authentication_method auth=SMTP_AUTH_PLAIN;
|
|
|
|
|
-
|
|
|
|
|
- if(!sett || !sub || !body || sett->man.mode==0) {
|
|
|
|
|
- return -1;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- strcpy(para.name_fr, "smartPDU");
|
|
|
|
|
- strcpy(para.mail_fr, sett->man.account);
|
|
|
|
|
-
|
|
|
|
|
- strcpy(para.user, sett->man.account);
|
|
|
|
|
- strcpy(para.passwd, sett->man.password);
|
|
|
|
|
-
|
|
|
|
|
- strcpy(para.port, sett->man.port);
|
|
|
|
|
- strcpy(para.server, sett->man.server);
|
|
|
|
|
- para.sub = sub;
|
|
|
|
|
- para.body = body;
|
|
|
|
|
-
|
|
|
|
|
- if(strcmp(sett->man.auth, "LOGIN")) {
|
|
|
|
|
- auth = SMTP_AUTH_LOGIN;
|
|
|
|
|
- }
|
|
|
|
|
- else if(strcmp(sett->man.auth, "CRAM-MD5")) {
|
|
|
|
|
- auth = SMTP_AUTH_CRAM_MD5;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- recv = sett->rcv.recv;
|
|
|
|
|
- for(i=0; i<SMTP_RECV_MAX; i++) {
|
|
|
|
|
- if(sett->rcv.recv[i].use && strlen(sett->rcv.recv[i].account)>0) {
|
|
|
|
|
- strcpy(para.name_to, recv[i].account);
|
|
|
|
|
- strcpy(para.mail_to, recv[i].account);
|
|
|
|
|
- r = send_mail(¶, auth);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ LOGE("___ send_mail failed, server: %s, port: %s failed\n", send->server, send->port);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+out:
|
|
|
|
|
+ lock_s_release(LOCK_ID_SMTP);
|
|
|
|
|
+ return r;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -4106,8 +4088,10 @@ typedef struct {
|
|
|
char body[2048];
|
|
char body[2048];
|
|
|
}smtp_pkt_t;
|
|
}smtp_pkt_t;
|
|
|
typedef struct {
|
|
typedef struct {
|
|
|
- handle_t list;
|
|
|
|
|
- GlobalDeviceManager *gdm;
|
|
|
|
|
|
|
+ handle_t list;
|
|
|
|
|
+ smtp_info_t *info;
|
|
|
|
|
+
|
|
|
|
|
+ GlobalDeviceManager *dm;
|
|
|
}smtp_handle_t;
|
|
}smtp_handle_t;
|
|
|
static smtp_handle_t smHandle;
|
|
static smtp_handle_t smHandle;
|
|
|
|
|
|
|
@@ -4121,13 +4105,15 @@ static void* smtp_thread(void *arg)
|
|
|
thread_handle_t *th=(thread_handle_t*)arg;
|
|
thread_handle_t *th=(thread_handle_t*)arg;
|
|
|
smtp_handle_t *h=(smtp_handle_t*)th->arg;
|
|
smtp_handle_t *h=(smtp_handle_t*)th->arg;
|
|
|
list_node_t *ln=NULL;
|
|
list_node_t *ln=NULL;
|
|
|
|
|
+ smtp_pkt_t *pkt=NULL;
|
|
|
|
|
+ smtp_send_t *send=&h->info->send;
|
|
|
|
|
+ smtp_recv_t *recv=h->info->recv;
|
|
|
|
|
|
|
|
- smtp_sett_t *sett=&h->gdm->smtp_sett;
|
|
|
|
|
while(th->quit==0) {
|
|
while(th->quit==0) {
|
|
|
r = xlist_take_node(h->list, &ln, 0);
|
|
r = xlist_take_node(h->list, &ln, 0);
|
|
|
if(r==0) {
|
|
if(r==0) {
|
|
|
- smtp_pkt_t *pkt=(smtp_pkt_t*)ln->data.buf;
|
|
|
|
|
- send_mails(sett, pkt->sub, pkt->body);
|
|
|
|
|
|
|
+ pkt = (smtp_pkt_t*)ln->data.buf;
|
|
|
|
|
+ send_mail(send, recv, pkt->sub, pkt->body, 1);
|
|
|
}
|
|
}
|
|
|
xlist_back_node(h->list, ln);
|
|
xlist_back_node(h->list, ln);
|
|
|
|
|
|
|
@@ -4146,14 +4132,17 @@ int smtp_init(void)
|
|
|
#ifdef USE_SMTP
|
|
#ifdef USE_SMTP
|
|
|
list_cfg_t lc;
|
|
list_cfg_t lc;
|
|
|
smtp_handle_t *h=&smHandle;
|
|
smtp_handle_t *h=&smHandle;
|
|
|
|
|
+ GlobalDeviceManager *dm=&__globalDeviceManage;
|
|
|
|
|
|
|
|
lc.mode = LIST_FULL_FIFO;
|
|
lc.mode = LIST_FULL_FIFO;
|
|
|
lc.max = 100;
|
|
lc.max = 100;
|
|
|
lc.log = 0;
|
|
lc.log = 0;
|
|
|
h->list = xlist_init(&lc);
|
|
h->list = xlist_init(&lc);
|
|
|
- h->gdm = &__globalDeviceManage;
|
|
|
|
|
|
|
|
|
|
- dev_smtp_init(h->gdm->db, &h->gdm->smtp_sett);
|
|
|
|
|
|
|
+ h->dm = dm;
|
|
|
|
|
+ h->info = &h->dm->smtpInfo;
|
|
|
|
|
+
|
|
|
|
|
+ dev_smtp_init(dm->db, h->info);
|
|
|
thread_start(THREAD_ID_SMTP, smtp_thread, h, 5*MB, 0);
|
|
thread_start(THREAD_ID_SMTP, smtp_thread, h, 5*MB, 0);
|
|
|
|
|
|
|
|
//smtp_test();
|
|
//smtp_test();
|
|
@@ -4176,9 +4165,10 @@ int smtp_deinit(void)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-int smtp_send(char *sub, char *body)
|
|
|
|
|
|
|
+static int post_data(char *sub, char *body)
|
|
|
{
|
|
{
|
|
|
int r=0;
|
|
int r=0;
|
|
|
|
|
+
|
|
|
#ifdef USE_SMTP
|
|
#ifdef USE_SMTP
|
|
|
smtp_pkt_t pkt;
|
|
smtp_pkt_t pkt;
|
|
|
smtp_handle_t *h=&smHandle;
|
|
smtp_handle_t *h=&smHandle;
|
|
@@ -4192,41 +4182,162 @@ int smtp_send(char *sub, char *body)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+int smtp_send(char *sub, char *body)
|
|
|
|
|
+{
|
|
|
|
|
+ int r=0;
|
|
|
|
|
+
|
|
|
|
|
+#ifdef USE_SMTP
|
|
|
|
|
+ smtp_handle_t *h=&smHandle;
|
|
|
|
|
+
|
|
|
|
|
+ r = send_mail(&h->info->send, h->info->recv, sub, body, 1);
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int smtp_post(char *sub, char *body)
|
|
|
|
|
+{
|
|
|
|
|
+ int r=0;
|
|
|
|
|
+
|
|
|
|
|
+#ifdef USE_SMTP
|
|
|
|
|
+ r = post_data(sub, body);
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+int smtp_post_alarm(int type, int subtype, int alarm_type, char *content)
|
|
|
|
|
+{
|
|
|
|
|
+ int r=0;
|
|
|
|
|
+
|
|
|
|
|
+#ifdef USE_SMTP
|
|
|
|
|
+ smtp_pkt_t pkt;
|
|
|
|
|
+
|
|
|
|
|
+ pkt.sub[0] = pkt.body[0] = 0;
|
|
|
|
|
+ switch(type) {
|
|
|
|
|
+ case ALARM_TYPE_POWER:
|
|
|
|
|
+ {
|
|
|
|
|
+ switch(alarm_type) {
|
|
|
|
|
+ case WARNING_V_UP:
|
|
|
|
|
+ //strcpy(pkt.sub, "");
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case WARNING_V_DOWN:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case WARNING_A_UP:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case WARNING_W_UP:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case WARNING_P_UP:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case 0 ... 2:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case ALARM_TYPE_SENSOR:
|
|
|
|
|
+ {
|
|
|
|
|
+ switch(subtype) {
|
|
|
|
|
+ case SENSOR_TYPE_TEMPERATURE:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_SMOKE:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_WATER:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_DOOR:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_GAS:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_AIR_PRESS:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case SENSOR_TYPE_DoubleT:
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ case ALARM_TYPE_NETWORK:
|
|
|
|
|
+ {
|
|
|
|
|
+ //
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ default:
|
|
|
|
|
+ return -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ snprintf(pkt.sub, sizeof(pkt.sub), "ALARM");
|
|
|
|
|
+ snprintf(pkt.body, sizeof(pkt.body), content);
|
|
|
|
|
+
|
|
|
|
|
+ r = post_data(pkt.sub, pkt.body);
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
int smtp_test(void)
|
|
int smtp_test(void)
|
|
|
{
|
|
{
|
|
|
int r=0,cnt=0;
|
|
int r=0,cnt=0;
|
|
|
char temp[200];
|
|
char temp[200];
|
|
|
|
|
+ smtp_handle_t *h=&smHandle;
|
|
|
|
|
|
|
|
#ifdef USE_SMTP
|
|
#ifdef USE_SMTP
|
|
|
- smtp_sett_t sett={
|
|
|
|
|
- .man = {
|
|
|
|
|
|
|
+ smtp_info_t info={
|
|
|
|
|
+ .send = {
|
|
|
.product_id = 0,
|
|
.product_id = 0,
|
|
|
.mode = 1,
|
|
.mode = 1,
|
|
|
|
|
+
|
|
|
.account = "rcp064867@163.com",
|
|
.account = "rcp064867@163.com",
|
|
|
- .password = "wanhong0219107X",
|
|
|
|
|
|
|
+ .password = "UODRIFWDFBTJTVLW",
|
|
|
.server = "smtp.163.com",
|
|
.server = "smtp.163.com",
|
|
|
|
|
+
|
|
|
.port = "25",
|
|
.port = "25",
|
|
|
|
|
+ //.port = "465",
|
|
|
|
|
+ //.port = "587",
|
|
|
|
|
+
|
|
|
.auth = "PLAIN",
|
|
.auth = "PLAIN",
|
|
|
|
|
+ //.auth = "LOGIN",
|
|
|
|
|
+ //.auth = "CRAM-MD5",
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- .rcv = {
|
|
|
|
|
.recv = {
|
|
.recv = {
|
|
|
{0, 1, "1556907721@qq.com"},
|
|
{0, 1, "1556907721@qq.com"},
|
|
|
- {1, 1, "cijiu0219@sina.com"},
|
|
|
|
|
- {2, 1, "jiuci4902@gmail.com"},
|
|
|
|
|
- {3, 1, "cijiu0219@hotmail.com"},
|
|
|
|
|
- {4, 1, "cijiu990219@outlook.com"},
|
|
|
|
|
|
|
+ {1, 1, "rcp064867@163.com"},
|
|
|
|
|
+ {2, 1, "cijiu0219@sina.com"},
|
|
|
|
|
+ {3, 1, "jiuci4902@gmail.com"},
|
|
|
|
|
+ {4, 1, "cijiu0219@hotmail.com"},
|
|
|
|
|
+ {5, 1, "cijiu990219@outlook.com"},
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
};
|
|
};
|
|
|
|
|
+ *h->info = info;
|
|
|
|
|
|
|
|
- char *sub="123";
|
|
|
|
|
- char *body="hello everyone";
|
|
|
|
|
- while(cnt++<10) {
|
|
|
|
|
- sprintf(temp, "%s %d", body, cnt);
|
|
|
|
|
- r = smtp_send(sub, temp);
|
|
|
|
|
- sleep(2);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ char *sub="123";
|
|
|
|
|
+ char *body="hello everyone";
|
|
|
|
|
+ while(cnt++<5) {
|
|
|
|
|
+ sprintf(temp, "%s %d", body, cnt);
|
|
|
|
|
+ r = smtp_send(sub, temp);
|
|
|
|
|
+ sleep(2);
|
|
|
|
|
+ }
|
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
return r;
|
|
return r;
|