testssmtp.c

来自「嵌入式linux下面的邮件发送程序」· C语言 代码 · 共 35 行

C
35
字号
#include <stdio.h>
#include "ssmtp.h"

int main(int argc, char *argv[])
{

 SMTP_Client_Info client;
 SMTP_Mail_Info mail;
 initClientInfo(&client);
 initMailInfo(&mail );

 client.host = "smtp.163.com";
 client.fromaddr = "xdz.s@163.com";
 client.fromName = "xudz";
 client.auth_user = "xdz.s";
 client.auth_pass = "********";
 client.auth_mech = 0 ;

 mail.to = "xdz.s@163.com";
 mail.subject = "alarm from ipcamer";
 mail.body = "something has happed ,\n,please check you room!";
 mail.attachment = "abc.jpg";

 int i = sendMail(&client , &mail);
 if (!i)
 {
	 printf("mail has sent!\n");
 }else{
	 printf("mail send error!\n");
 }

	
	return 0;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?