3a6f81aad01bce0258eb518743a325e6032742cc chinhli Mon Aug 27 15:19:35 2012 -0700 Bug 8832 using /usr/sbin/sendmail -t -oi option to send mail to user. diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c index 95a78d5..39c5985 100644 --- src/hg/hgLogin/hgLogin.c +++ src/hg/hgLogin/hgLogin.c @@ -66,31 +66,35 @@ } char *mailReturnAddr() /* Return the return addr. to be used by outbound mail or NULL. Allocd here. */ { if isEmpty(cfgOption(CFG_LOGIN_MAIL_RETURN_ADDR)) return cloneString("NULL_mailReturnAddr"); else return cloneString(cfgOption(CFG_LOGIN_MAIL_RETURN_ADDR)); } int mailItOut(char *toAddr, char *subject, char *msg, char *fromAddr) /* send mail to toAddr address */ { char cmd[4096]; - safef(cmd,sizeof(cmd), "echo '%s' | /bin/mail -s \"%s\" %s -- -f%s", +char fullMail[4096]; +safef(fullMail,sizeof(fullMail),"Form: %s\nTo: %s\nSubject: %s\n\n%s", + fromAddr, toAddr, subject, msg); +safef(cmd,sizeof(cmd), "echo '%s' | /usr/sbin/sendmail -t -oi",fullMail); +//safef(cmd,sizeof(cmd), "echo '%s' | /bin/mail -s \"%s\" %s -- -f%s", msg, subject, toAddr, fromAddr); int result = system(cmd); return result; } /* ---- password functions depend on optionally installed openssl lib ---- */ #ifdef USE_SSL #include <openssl/md5.h> void cryptWikiWay(char *password, char *salt, char* result) /* encrypt password in mediawiki format - ':B:'.$salt.':'. md5($salt.'-'.md5($password ) */ { int i; unsigned char result1[MD5_DIGEST_LENGTH];