d54ea5c26f948002fee2005d7dab904b4ec718d4
chinhli
  Thu Aug 23 15:52:15 2012 -0700
Bug #8832 - Change mail.optionformat in hg.conf to mailx.version.
diff --git src/hg/hgLogin/hgLogin.c src/hg/hgLogin/hgLogin.c
index cfb3ed8..448319c 100644
--- src/hg/hgLogin/hgLogin.c
+++ src/hg/hgLogin/hgLogin.c
@@ -25,31 +25,31 @@
 char msg[4096] = "";
 char *incorrectUsernameOrPassword="The username or password you entered is incorrect.";
 char *incorrectUsername="The username you entered is incorrect.";
 /* The excludeVars are not saved to the cart. */
 char *excludeVars[] = { "submit", "Submit", "debug", "fixMembers", "update", 
      "hgLogin_password", "hgLogin_password2", "hgLogin_newPassword1",
      "hgLogin_newPassword2", NULL };
 struct cart *cart;	/* This holds cgi and other variables between clicks. */
 char *database;		/* Name of genome database - hg15, mm3, or the like. */
 struct hash *oldCart;	/* Old cart hash. */
 char *errMsg;           /* Error message to show user when form data rejected */
 char brwName[64];
 char brwAddr[256];
 char signature[256];
 char returnAddr[256];
-char mailFormat[32];
+char mailxVer[32];
 /* ---- Global helper functions ---- */
 char *browserName()
 /* Return the browser name like 'UCSC Genome Browser' */
 {
 if isEmpty(cfgOption(CFG_LOGIN_BROWSER_NAME))
     return cloneString("NULL_browserName");
 else
     return cloneString(cfgOption(CFG_LOGIN_BROWSER_NAME));
 }
 
 char *browserAddr()
 /* Return the browser address like 'http://genome.ucsc.edu' */
 {
 if isEmpty(cfgOption(CFG_LOGIN_BROWSER_ADDR))
     return cloneString("NULL_browserAddr");
@@ -63,47 +63,47 @@
 if isEmpty(cfgOption(CFG_LOGIN_MAIL_SIGNATURE))
     return cloneString("NULL_mailSignature");
 else
     return cloneString(cfgOption(CFG_LOGIN_MAIL_SIGNATURE));
 }
 
 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));
 }
 
-char *mailOptionFormat()
+char *mailxVersion()
 /* Return the mail option format to be used by mail command */
 {
-if isEmpty(cfgOption(CFG_MAIL_OPTIONFORMAT))
+if isEmpty(cfgOption(CFG_MAILX_VERSION))
     return cloneString("SENDMAIL");
 else
-    return cloneString(cfgOption(CFG_MAIL_OPTIONFORMAT));
+    return cloneString(cfgOption(CFG_MAILX_VERSION));
 }
 
 int mailItOut(char *toAddr, char *subject, char *msg, char *fromAddr)
 /* send mail to toAddr address */
 {
 char cmd[4096];
-if (sameString(mailFormat, "POSTFIX"))
+if (sameString(mailxVer, "V12"))
     safef(cmd,sizeof(cmd), "echo '%s' | /bin/mail -s \"%s\" -r %s %s",
         msg, subject, fromAddr, toAddr);
-else 
+else /* default to old V8 version */
     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;
@@ -1233,31 +1233,31 @@
 /* return to "returnto" URL */
 returnToURL(150);
 }
 
 void doMiddle(struct cart *theCart)
 /* Write the middle parts of the HTML page.
  * This routine sets up some globals and then
  * dispatches to the appropriate page-maker. */
 {
 struct sqlConnection *conn = hConnectCentral();
 cart = theCart;
 safecpy(brwName,sizeof(brwName), browserName());
 safecpy(brwAddr,sizeof(brwAddr), browserAddr());
 safecpy(signature,sizeof(signature), mailSignature());
 safecpy(returnAddr,sizeof(returnAddr), mailReturnAddr());
-safecpy(mailFormat,sizeof(mailFormat), mailOptionFormat());
+safecpy(mailxVer,sizeof(mailxVer), mailxVersion());
 
 
 if (cartVarExists(cart, "hgLogin.do.changePasswordPage"))
     changePasswordPage(conn);
 else if (cartVarExists(cart, "hgLogin.do.changePassword"))
     changePassword(conn);
 else if (cartVarExists(cart, "hgLogin.do.displayAccHelpPage"))
     displayAccHelpPage(conn);
 else if (cartVarExists(cart, "hgLogin.do.accountHelp"))
     accountHelp(conn);
 else if (cartVarExists(cart, "hgLogin.do.activateAccount"))
     activateAccount(conn);
 else if (cartVarExists(cart, "hgLogin.do.displayActMailSuccess"))
     displayActMailSuccess();
 else if (cartVarExists(cart, "hgLogin.do.displayMailSuccess"))