summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorLuzhenping <luzhenping@zthsoft.net>2015-06-11 02:16:13 (GMT)
committer Luzhenping <luzhenping@zthsoft.net>2015-06-11 02:16:13 (GMT)
commit585ef308a1e67c2b06436062d278b955c3221405 (patch)
tree2d317822de59fcee601984bdd3b01003893d0fbe
parentc2733b869c68fbc681fc31be0849d2bb56caafb9 (diff)
downloadlibxemail-585ef308a1e67c2b06436062d278b955c3221405.zip
libxemail-585ef308a1e67c2b06436062d278b955c3221405.tar.gz
libxemail-585ef308a1e67c2b06436062d278b955c3221405.tar.bz2
Fixed log print bug.
-rw-r--r--lib/xemail.c52
1 files changed, 2 insertions, 50 deletions
diff --git a/lib/xemail.c b/lib/xemail.c
index 09069ad..a7b0980 100644
--- a/lib/xemail.c
+++ b/lib/xemail.c
@@ -47,6 +47,8 @@
#if Z_DBG > 0
#define ZEMAIL_DBG(fmt, arg...) \
fprintf(stdout, "%s:%d "fmt, __func__, __LINE__, ##arg)
+#else
+#define ZEMAIL_DBG(fmt, arg...)
#endif
#define ZEMAIL_ERR(fmt, arg...) \
@@ -1269,51 +1271,6 @@ PZEMAIL xemailCreate (PCHAR pcFrom, PCHAR pcSubject)
return (pzemail);
}
-
-#if 1
-static const char *payload_text[] = {
- "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
- "To: " "\r\n",
- "From: " "(Example User)\r\n",
- "Cc: " "(Another example User)\r\n",
- "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@rfcpedant.example.org>\r\n",
- "Subject: SMTP example message\r\n",
- "Importance: Low""X-Priority: 5""X-MSMail-Priority: Low",
- "\r\n", /* empty line to divide headers from body, see RFC5322 */
- "The body of the message starts here.\r\n",
- "\r\n",
- "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
- "Check RFC5322.\r\n",
- NULL
-};
-
-struct upload_status {
- int lines_read;
-};
-
-static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
-{
- struct upload_status *upload_ctx = (struct upload_status *)userp;
- const char *data;
-
- if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
- return 0;
- }
-
- data = payload_text[upload_ctx->lines_read];
-
- if(data) {
- size_t len = strlen(data);
- memcpy(ptr, data, len);
- upload_ctx->lines_read++;
-
- printf("message: %s", (char *)ptr);
- return len;
- }
-
- return 0;
-}
-#endif
/*********************************************************************************************************
** 函数名称: xemailSend
** 功能描述: email 发送主函数
@@ -1329,9 +1286,6 @@ INT xemailSend (PZEMAIL pzemail, PCHAR pcSmtpServer, PCHAR pcUserName, PCHAR
{
CURL *curl;
CURLcode result = CURLE_FAILED_INIT;
- struct upload_status upload_ctx;
-
- upload_ctx.lines_read = 0;
curl = curl_easy_init();
if (curl) {
@@ -1369,8 +1323,6 @@ INT xemailSend (PZEMAIL pzemail, PCHAR pcSmtpServer, PCHAR pcUserName, PCHAR
curl_easy_setopt(curl, CURLOPT_MAIL_RCPT, recipients);
curl_easy_setopt(curl, CURLOPT_READFUNCTION, __GetEmailContent);
curl_easy_setopt(curl, CURLOPT_READDATA, pzemail);
-// curl_easy_setopt(curl, CURLOPT_READFUNCTION, payload_source);
-// curl_easy_setopt(curl, CURLOPT_READDATA, &upload_ctx);
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
if (pzemail->ZEMAIL_fp) {