²»ÖªµÀΪʲô·¢Ë͵ĸ½¼þµÍÓÚ15K´óСÊÇÕý³££¬µ«ÊÇ´óÓÚ15Kʱ·¢ËÍÓʼþ¾Í»ásocket³¬Ê±·¢ËÍʧ°Ü
Ôõô¸½¼þÁ¬1M¶¼´ïµ½²»ÁË£¬ÓôÃÆÖС£¡£¡£
C/C++ code:
int mail(void){
if(!openMail()){
printf("open mail error\n");
return -1;
}
if(!SendMailGeneral(to,now,subject,"2010-1-16")){
printf("send mail error\n");
return -1;
}
if(SendAffix("test.txt") != 1) {
printf("send affix error\n");
}
if(!End()){
printf("End error\n");
return -1;
}
printf("send over\n");
Destory();
}
/**
* 2.·¢ËÍÓʼþ
*/
int SendMailGeneral(const char *to,const char *date,const char *subject,const char *data) {
if(to == NULL || date == NULL || subject == NULL) return -1;
sprintf(from,"MAIL from: <%s>\r\n",SERVERMAIL);
rt = send(s,from,strlen(from),0);
if(!GetResponse()) return -1;
sprintf(To,"RCPT TO: <%s>\r\n",to);
rt = send(s,To,strlen(To),0);
if(!GetResponse()) return -1;
sprintf(tmpbuf,"DATA\r\n");
rt = send(s,tmpbuf,strlen(tmpbuf),0);
if(!GetResponse()) return -1;
sprintf(from,"from: %s\r\n",SERVERMAIL);
sprintf(To,"To: %s\r\n",to);
sprintf(Date,"Date: %s\r\n",date);
sprintf(Subject,"Subject: %s\r\n",subject);
×î½ü·Å¼ÙÏëÑо¿linux£¬ÇëÄÄλ¸ßÊÖ½éÉÜÒ»ÏÂÕâ·½ÃæµÄºÃµÄÊé¼®ºÍÊÓÆµ°¡£¬Èç¹ûÓÐÊÓÆµ½Ì³ÌµÄ»°Äܲ»ÄÜ·¢µ½ÎÒµÄÓÊÏä 937607911@qq.com Íò·Ö¸Ðл
³Ã×Ågoogle»¹Ã»×ߣ¬¸Ï½ôgoogleÒ»ÏÂßÂ
ÒÔǰÓÐûÓиã¸ö
ÄãÊÇÏëÉîÈëÑо¿£¬» ......