Rev 15277 | Rev 15489 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 15277 | Rev 15488 | ||
---|---|---|---|
Line 1731... | Line 1731... | ||
1731 | mystrncpy(buf,pb,sizeof(buf)); |
1731 | mystrncpy(buf,pb,sizeof(buf)); |
1732 | pb=getvar(b2);if(pb==NULL) pb=""; |
1732 | pb=getvar(b2);if(pb==NULL) pb=""; |
1733 | setvar(b1,pb); setvar(b2,buf); |
1733 | setvar(b1,pb); setvar(b2,buf); |
1734 | } |
1734 | } |
1735 | 1735 | ||
- | 1736 | /** |
|
1736 |
|
1737 | * Send a mail |
- | 1738 | * p contains 4 lines : |
|
- | 1739 | $To\ |
|
- | 1740 | $from\ |
|
- | 1741 | $subject\ |
|
- | 1742 | $body\ |
|
- | 1743 | The first line ($mailheader) must contain the recipient address. |
|
- | 1744 | */ |
|
1737 | void exec_mailto(char *p) |
1745 | void exec_mailto(char *p) |
1738 | { |
1746 | { |
- | 1747 | char *from,*subject,*body,*pp,*charset; |
|
- | 1748 | char mail_content[MAX_LINELEN+1], buf[MAX_LINELEN+1]; |
|
1739 |
|
1749 | /*int status; |
- | 1750 | FILE *mailer;// need stdio.h */ |
|
1740 | 1751 | ||
1741 | if(!trusted_module() || is_class_module) return; |
1752 | if(!trusted_module() || is_class_module) return; |
- | 1753 | ||
1742 |
|
1754 | from=strchr(p,'\n'); if(from==NULL) return; |
1743 | * |
1755 | *from++=0; p=find_word_start(p); |
1744 | if(*p==0) return; |
1756 | if(*p==0) return; |
1745 |
|
1757 | subject=strchr(from,'\n'); if(subject==NULL) return; |
- | 1758 | *subject++=0; from=find_word_start(from); |
|
1746 | * |
1759 | if(*from!=0){ |
- | 1760 | snprintf(buf,sizeof(buf),"From:%s\n",from); |
|
- | 1761 | } |
|
- | 1762 | body=strchr(subject,'\n'); if(body==NULL) return; |
|
- | 1763 | *body++=0; subject=find_word_start(subject); |
|
- | 1764 | ||
1747 | for(pp= |
1765 | for(pp=subject;*pp;pp++) if(*pp=='"' || *pp=='\n') *pp=' '; |
- | 1766 | ||
- | 1767 | charset=getvar("wims_main_font");if(charset==NULL) charset="windows-1252"; |
|
- | 1768 | snprintf(mail_content,sizeof(mail_content), |
|
- | 1769 | "To:%s\n%sSubject:%s\nContent-Type: text/html;charset=\"%s\"\n\n%s",p,buf,subject,charset,body); |
|
- | 1770 | ||
1748 | accessfile( |
1771 | accessfile(mail_content,"w","%s/mail.eml",tmp_dir); |
1749 | wrapexec=1; |
1772 | wrapexec=1; |
1750 | call_sh(" |
1773 | call_sh("cat %s/mail.eml | /usr/sbin/sendmail -tvv 2> %s/sendmail.log",tmp_dir,tmp_dir); |
1751 | mail_opt, p1,p,tmp_dir,tmp_dir); |
- | |
- | 1774 | ||
1752 | mail_log(p); |
1775 | mail_log(p); |
1753 | *p=0; |
1776 | *p=0; |
1754 | } |
1777 | } |
1755 | 1778 | ||
1756 | /* Generates a user error. Internal and undocumented. */ |
1779 | /* Generates a user error. Internal and undocumented. */ |