- 论坛徽章:
- 3
|
原帖由 chealim 于 2008-11-30 20:30 发表
在linux有什么工具是发邮件的?没用过
我写的源码在附件
为什么发送txt的附件就可以呢?我怀疑是格式的设置有问题。
请看看源码
421是smtp.163.com返回的吗?
你发送的图片没有超过邮箱里附件大小限制吧,另外还有是否被当成垃圾邮件之类的(我没找到163邮箱把图片当垃圾的设置)。
163新申请的邮箱不开启smtp和pop3, 我用sina邮箱可以发送jpg图片(24.2k没测试大文件).
测试时修改了一些代码去掉部分警告和错误。但没改动邮件格式。
11 #include <netinet/in.h>
12 #include <sys/socket.h>
13 #include <arpa/inet.h>
...
644 // mybase64.b64encode((char *)datasrc, (char *)datades);
645
646 Base64Encode22((unsigned char *)datades, (unsigned char *)datasrc, stringlen);
647
648 //for( timedelay=0; timedelay<100; timedelay++) {
649 // for( timedelay1=0; timedelay1<100; timedelay1++);
650 rt = send(s, (char *)datades, strlen((char *)datades), 0);
651 //}
652
653 //rt = send(s,(char *)datades,sendlen,0);
...
739 if(argc < 1)
740 {
741 printf("agrv error\n");
742 free(m_data);
743 }
744
745 strcpy(m_data, "this is mail content");
...
781 char m_data64[256];
782 Base64_Code((unsigned char *)m_data, (unsigned char *)m_data64);
783 if(!SendMail(m_From, m_To, m_date, m_Subject, m_data64))
784 {
785 printf("send mail error\n");
786 return -1;
787 }
...
790 // if(SendAffix("test.txt") != 1)
791 if(1 != SendAffix("test.jpg"))
792 {
793 printf("send affix error\n");
794 } |
|