Rev 15489 | Rev 15491 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15489 | Rev 15490 | ||
---|---|---|---|
Line 1743... | Line 1743... | ||
1743 | The first line ($mailheader) must contain the recipient address. |
1743 | The first line ($mailheader) must contain the recipient address. |
1744 | */ |
1744 | */ |
1745 | void exec_mailto(char *p) |
1745 | void exec_mailto(char *p) |
1746 | { |
1746 | { |
1747 | char *from,*subject,*body,*pp,*charset; |
1747 | char *from,*subject,*body,*pp,*charset; |
1748 | char mail_content[MAX_LINELEN+1]; |
1748 | char mail_content[MAX_LINELEN+1],buf[MAX_LINELEN+1]; |
1749 | /*int status; |
1749 | /*int status; |
1750 | FILE *mailer;// need stdio.h */ |
1750 | FILE *mailer;// need stdio.h */ |
1751 | 1751 | ||
1752 | if(!trusted_module() || is_class_module) return; |
1752 | if(!trusted_module() || is_class_module) return; |
1753 | // searches for the first occurrence of \n |
1753 | // searches for the first occurrence of \n |
Line 1769... | Line 1769... | ||
1769 | for(pp=subject;*pp;pp++) if(*pp=='"' || *pp=='\n') *pp=' '; |
1769 | for(pp=subject;*pp;pp++) if(*pp=='"' || *pp=='\n') *pp=' '; |
1770 | 1770 | ||
1771 | charset=getvar("wims_main_font");if(charset==NULL) charset="windows-1252"; |
1771 | charset=getvar("wims_main_font");if(charset==NULL) charset="windows-1252"; |
1772 | 1772 | ||
1773 | if(*from!=0){ |
1773 | if(*from!=0){ |
1774 | snprintf( |
1774 | snprintf(buf,sizeof(buf),"From:%s\n",from); |
1775 | "To:%s\nFrom:%s\nSubject:%s\nContent-Type: text/html;charset=\"%s\"\n\n%s\n",p,from,subject,charset,body); |
- | |
1776 | } else |
1775 | } else buf[0]=0; |
- | 1776 | ||
1777 |
|
1777 | snprintf(mail_content,sizeof(mail_content), |
1778 | "To:%s\n |
1778 | "To:%s\n%sSubject:%s\nContent-Type: text/html;charset=\"%s\"\n\n%s\n",p,buf,subject,charset,body); |
1779 | } |
1779 | |
1780 | accessfile(mail_content,"w","%s/mail.eml",tmp_dir); |
1780 | accessfile(mail_content,"w","%s/mail.eml",tmp_dir); |
1781 | wrapexec=1; |
1781 | wrapexec=1; |
1782 | // you can add option '-vv' to make sendmail more verbose. |
1782 | // you can add option '-vv' to make sendmail more verbose. |
1783 | call_sh("cat %s/mail.eml | /usr/sbin/sendmail -t 2> %s/sendmail.log",tmp_dir,tmp_dir); |
1783 | call_sh("cat %s/mail.eml | /usr/sbin/sendmail -t 2> %s/sendmail.log",tmp_dir,tmp_dir); |
1784 | 1784 |