Implemented 'Default email from'

SVN revision: 1790
This commit is contained in:
Stefan Ritt 2007-02-16 16:06:47 +00:00
parent 08a8551c3b
commit 519c542b70
2 changed files with 12 additions and 5 deletions

View File

@ -2056,6 +2056,9 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
<li> <li>
<b><code>Use Email From = &lt;string&gt;</code></b> <b><code>Use Email From = &lt;string&gt;</code></b>
</li> </li>
<li>
<b><code>Default Email From = &lt;string&gt;</code></b>
</li>
<li> <li>
<b><code>Use Email Heading = &lt;string&gt;</code></b> <b><code>Use Email Heading = &lt;string&gt;</code></b>
</li> </li>
@ -2115,11 +2118,12 @@ Options Location = Main Building{a}, New Building{b}, Old Building{c}
for the "<i>From:</i>" field in the email. Since more and more email for the "<i>From:</i>" field in the email. Since more and more email
servers do not accept invalid <i>"From:"</i> addresses in order to reduce servers do not accept invalid <i>"From:"</i> addresses in order to reduce
spam mail, it might be important that a "real" email address is used in spam mail, it might be important that a "real" email address is used in
the <i>"From:"</i> field. By default, the email address of the currently the <i>"From:"</i> field. If <b><code>Use Email From</code></b> is
present, it is always used. If not, the email address of the currently
logged in user is used for the <i>"From:"</i> field. If no user is logged logged in user is used for the <i>"From:"</i> field. If no user is logged
in, or the current user has not specified a email address in the password in, or the current user has not specified a email address in the password
database, the setting of the option <b><code>Use Email From</code></b> is database, the setting of the option <b><code>Default Email From</code></b>
used for the "<i>From:</i>" field. Only if this option is not specified, is used for the "<i>From:</i>" field. Only if this option is not specified,
a generic address <i>ELOG@&lt;hostname&gt;</i> is used, which might be a generic address <i>ELOG@&lt;hostname&gt;</i> is used, which might be
rejected by the SMTP server however. rejected by the SMTP server however.
</p> </p>

View File

@ -3386,13 +3386,16 @@ void retrieve_email_from(LOGBOOK * lbs, char *ret, char *ret_name, char attrib[M
char slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH]; char slist[MAX_N_ATTR + 10][NAME_LENGTH], svalue[MAX_N_ATTR + 10][NAME_LENGTH];
int i; int i;
if (isparam("full_name") && isparam("user_email")) { if (getcfg(lbs->name, "Use Email from", str, sizeof(str))) {
strlcpy(email_from, str, sizeof(email_from));
strlcpy(email_from_name, str, sizeof(email_from));
} else if (isparam("full_name") && isparam("user_email")) {
strlcpy(email_from_name, getparam("full_name"), sizeof(email_from_name)); strlcpy(email_from_name, getparam("full_name"), sizeof(email_from_name));
strlcat(email_from_name, " <", sizeof(email_from_name)); strlcat(email_from_name, " <", sizeof(email_from_name));
strlcat(email_from_name, getparam("user_email"), sizeof(email_from_name)); strlcat(email_from_name, getparam("user_email"), sizeof(email_from_name));
strlcat(email_from_name, ">", sizeof(email_from_name)); strlcat(email_from_name, ">", sizeof(email_from_name));
strlcpy(email_from, getparam("user_email"), sizeof(email_from)); strlcpy(email_from, getparam("user_email"), sizeof(email_from));
} else if (getcfg(lbs->name, "Use Email from", str, sizeof(str))) { } else if (getcfg(lbs->name, "Default Email from", str, sizeof(str))) {
strlcpy(email_from, str, sizeof(email_from)); strlcpy(email_from, str, sizeof(email_from));
strlcpy(email_from_name, str, sizeof(email_from)); strlcpy(email_from_name, str, sizeof(email_from));
} else { } else {