Added emailing of attachments

SVN revision: 565
This commit is contained in:
Stefan Ritt 2003-07-01 06:21:19 +00:00
parent 291eed6a65
commit 6c7f5131a4
3 changed files with 357 additions and 175 deletions

View File

@ -8,6 +8,8 @@ Version 2.3.9, released June xxth, 2003
- Remove blanks from "Referer:" - Remove blanks from "Referer:"
- Fixed problem with Reply-To in elog utility - Fixed problem with Reply-To in elog utility
- Don't send email notificatin to users which are not in the 'Login user' list - Don't send email notificatin to users which are not in the 'Login user' list
- Replace 'Email message body' by 'Email format'
- Send attachments as email attachments
Version 2.3.8, released June 4th, 2003 Version 2.3.8, released June 4th, 2003
====================================== ======================================

View File

@ -1033,8 +1033,14 @@ Email Subject = &lt;string&gt;</b></code> statement specifies which text is
used as the email subject. The text can contain <b><code>$&lt;attribute&gt; used as the email subject. The text can contain <b><code>$&lt;attribute&gt;
</code></b>statements which are substituted with the current value of that </code></b>statements which are substituted with the current value of that
attribute. For a full list of possible substitutions, see the attribute. For a full list of possible substitutions, see the
"<I>Subst &lt;attribute&gt;</I>" option. The option <b><code>Use Email From = &lt;string&gt; "<I>Subst &lt;attribute&gt;</I>" option.<p>
</code></b> is used for the "<I>from</I>" field in the email. If the flag <b><code>
The option <b><code>Use Email From = &lt;string&gt;
</code></b> is used for the "<I>From:</I>" field in the email. Please note that more and
more email servers do not accept invalid <I>"From:"</I> addresses, in order to reduce spam mail.
So it might be necessary to use this option to supply a "real" email address.<p>
If the flag <b><code>
Omit Email To</b></code> is set to <b>1</b>, the <i>To:</i> field in the email is Omit Email To</b></code> is set to <b>1</b>, the <i>To:</i> field in the email is
left empty instead set to the real email address of the recipients. This can left empty instead set to the real email address of the recipients. This can
be useful if one recipient should not see the email addresses of the other recipients. be useful if one recipient should not see the email addresses of the other recipients.
@ -1143,10 +1149,21 @@ suppresses this display, in case users need not see that email is being sent and
The default is <b>1</b>. The default is <b>1</b>.
<p> <p>
<li><b><code>Email message body = 0|1</code></b> <li><b><code>Email Format = &lt;n&gt;</code></b>
</br> </br>
If this flag is <b>1</b>, the email notification send by elog contains the Specifies what is sent in an email notification. &lt;n&gt; is the sum of following
full message body in addition to the attributes. The default is <b>0</b>. flags:<br>
<ul>
<li>1 : Send heading line "A new entry has been submitted..."
<li>2 : Send attributes
<li>4 : Send URL of logbook entry
<li>8 : Send message body
<li>16: Send optional attachments as email attachments
</ul>
So to send for example only the attributes and the URL, set &lt;n&gt;
to <b>6</b>. Default is <b>31</b> (send everything).
<p> <p>
<li><b><code>Suppress Email on edit = 0|1</code></b> <li><b><code>Suppress Email on edit = 0|1</code></b>

View File

@ -6,6 +6,9 @@
Contents: Web server program for Electronic Logbook ELOG Contents: Web server program for Electronic Logbook ELOG
$Log$ $Log$
Revision 1.122 2003/07/01 06:21:19 midas
Added emailing of attachments
Revision 1.121 2003/06/30 18:38:21 midas Revision 1.121 2003/06/30 18:38:21 midas
Increase textarea width for old messages according to longest line Increase textarea width for old messages according to longest line
@ -886,7 +889,7 @@
\********************************************************************/ \********************************************************************/
/* Version of ELOG */ /* Version of ELOG */
#define VERSION "2.3.8" #define VERSION "2.3.9"
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>
@ -1437,6 +1440,37 @@ unsigned int t, pad;
*(--d) = '='; *(--d) = '=';
} }
void base64_bufenc(unsigned char *s, int len, char *d)
{
unsigned int t, pad;
int i;
pad = 3 - len % 3;
if (pad == 3)
pad = 0;
for (i=0 ; i<len ; )
{
t = s[i++] << 16;
if (i<len)
t |= s[i++] << 8;
if (i<len)
t |= s[i++] << 0;
*(d+3) = map[t & 63];
t >>= 6;
*(d+2) = map[t & 63];
t >>= 6;
*(d+1) = map[t & 63];
t >>= 6;
*(d+0) = map[t & 63];
d += 4;
}
*d = 0;
while (pad--)
*(--d) = '=';
}
void do_crypt(char *s, char *d) void do_crypt(char *s, char *d)
{ {
#ifdef HAVE_CRYPT #ifdef HAVE_CRYPT
@ -1539,20 +1573,26 @@ struct timeval timeout;
} }
INT sendmail(char *smtp_host, char *from, char *to, char *subject, char *text, BOOL email_to, char *url) INT sendmail(LOGBOOK *lbs, char *smtp_host, char *from, char *to, char *subject, char *text,
BOOL email_to, char *url, char att_file[MAX_ATTACHMENTS][256])
{ {
struct sockaddr_in bind_addr; struct sockaddr_in bind_addr;
struct hostent *phe; struct hostent *phe;
int i, n, s, offset, strsize; int i, n, s, offset, strsize, n_att, index, fh;
char buf[80]; char buf[80];
char *str, *p; char *str, *p, boundary[256], file_name[MAX_PATH_LENGTH];
time_t now; time_t now;
struct tm *ts; struct tm *ts;
char list[1024][NAME_LENGTH]; char list[1024][NAME_LENGTH], buffer[256];
if (verbose) if (verbose)
printf("\n\nEmail from %s to %s, SMTP host %s:\n", from, to, smtp_host); printf("\n\nEmail from %s to %s, SMTP host %s:\n", from, to, smtp_host);
/* count attachments */
n_att = 0;
if (att_file)
for (n_att = 0 ; att_file[n_att][0] && n_att < MAX_ATTACHMENTS ; n_att++);
/* create a new socket for connecting to remote server */ /* create a new socket for connecting to remote server */
s = socket(AF_INET, SOCK_STREAM, 0); s = socket(AF_INET, SOCK_STREAM, 0);
if (s == -1) if (s == -1)
@ -1578,27 +1618,27 @@ char list[1024][NAME_LENGTH];
str = malloc(strsize); str = malloc(strsize);
recv_string(s, str, strsize, 10000); recv_string(s, str, strsize, 10000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
/* drain server messages */ /* drain server messages */
do do
{ {
str[0] = 0; str[0] = 0;
recv_string(s, str, strsize, 300); recv_string(s, str, strsize, 300);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
} while (str[0]); } while (str[0]);
snprintf(str, strsize - 1, "HELO %s\r\n", host_name); snprintf(str, strsize - 1, "HELO %s\r\n", host_name);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "MAIL FROM: <%s>\r\n", from); snprintf(str, strsize - 1, "MAIL FROM: <%s>\r\n", from);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
/* break recipients into list */ /* break recipients into list */
n = strbreak(to, list, 1024); n = strbreak(to, list, 1024);
@ -1607,16 +1647,16 @@ char list[1024][NAME_LENGTH];
{ {
snprintf(str, strsize - 1, "RCPT TO: <%s>\r\n", list[i]); snprintf(str, strsize - 1, "RCPT TO: <%s>\r\n", list[i]);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
} }
snprintf(str, strsize - 1, "DATA\r\n"); snprintf(str, strsize - 1, "DATA\r\n");
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
if (email_to) if (email_to)
snprintf(str, strsize - 1, "To: %s\r\n", to); snprintf(str, strsize - 1, "To: %s\r\n", to);
@ -1624,30 +1664,26 @@ char list[1024][NAME_LENGTH];
snprintf(str, strsize - 1, "To: ELOG user\r\n"); snprintf(str, strsize - 1, "To: ELOG user\r\n");
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "From: %s\r\nSubject: %s\r\n", from, subject); snprintf(str, strsize - 1, "From: %s\r\nSubject: %s\r\n", from, subject);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "X-Mailer: Elog, Version %s\r\n", VERSION); snprintf(str, strsize - 1, "X-Mailer: Elog, Version %s\r\n", VERSION);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
if (url) if (url)
{ {
snprintf(str, strsize - 1, "X-Elog-URL: %s\r\n", url); snprintf(str, strsize - 1, "X-Elog-URL: %s\r\n", url);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
} }
snprintf(str, strsize - 1, "X-Elog-submit-type: web|elog\r\n"); snprintf(str, strsize - 1, "X-Elog-submit-type: web|elog\r\n");
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "Content-Type: text/plain\r\n");
send(s, str, strlen(str), 0);
if (verbose) puts(str);
time(&now); time(&now);
ts = localtime(&now); ts = localtime(&now);
@ -1655,10 +1691,40 @@ char list[1024][NAME_LENGTH];
offset = (-(int)timezone); offset = (-(int)timezone);
if (ts->tm_isdst) if (ts->tm_isdst)
offset += 3600; offset += 3600;
snprintf(str, strsize - 1, "Date: %s %+03d%02d\r\n\r\n", buf, snprintf(str, strsize - 1, "Date: %s %+03d%02d\r\n", buf,
(int) (offset/3600), (int) ((abs((int)offset)/60) % 60)); (int) (offset/3600), (int) ((abs((int)offset)/60) % 60));
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
if (n_att > 0)
{
snprintf(str, strsize - 1, "MIME-Version: 1.0\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
sprintf(boundary, "%04X-%04X=:%04X", rand(), rand(), rand());
snprintf(str, strsize - 1, "Content-Type: MULTIPART/MIXED; BOUNDARY=\"%s\"\r\n\r\n", boundary);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, " This message is in MIME format. The first part should be readable text,\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, " while the remaining parts are likely unreadable without MIME-aware tools.\r\n\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "--%s\r\nContent-Type: TEXT/PLAIN; charset=US-ASCII\r\n\r\n", boundary);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
}
else
{
snprintf(str, strsize - 1, "Content-Type: TEXT/PLAIN; charset=US-ASCII\r\n\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
}
/* analyze text for "." at beginning of line */ /* analyze text for "." at beginning of line */
p = text; p = text;
@ -1671,18 +1737,91 @@ char list[1024][NAME_LENGTH];
strlcat(str, "\r\n..\r\n", strsize); strlcat(str, "\r\n..\r\n", strsize);
} }
strlcat(str, p, strsize); strlcat(str, p, strsize);
strlcat(str, "\r\n.\r\n", strsize); strlcat(str, "\r\n\r\n", strsize);
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
if (n_att > 0)
{
snprintf(str, strsize - 1, "--%s\r\n", boundary);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
for (index=0 ; index<n_att ; index++)
{
/* return proper Content-Type for file type */
for (i=0 ; i<(int)strlen(att_file[index]) ; i++)
str[i] = toupper(att_file[index][i]);
str[i] = 0;
for (i=0 ; filetype[i].ext[0] ; i++)
if (strstr(str, filetype[i].ext))
break;
if (filetype[i].ext[0])
snprintf(str, strsize - 1, "Content-Type: %s; name=\"%s\"\r\n", filetype[i].type, att_file[index]+14);
else if (strchr(str, '.') == NULL)
snprintf(str, strsize - 1, "Content-Type: text/plain; name=\"%s\"\r\n", att_file[index]+14);
else
snprintf(str, strsize - 1, "Content-Type: application/octet-stream; name=\"%s\"\r\n", att_file[index]+14);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "Content-Transfer-Encoding: BASE64\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "Content-Disposition: attachment; filename=\"%s\"\r\n\r\n", att_file[index]+14);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
/* encode file */
strlcpy(file_name, lbs->data_dir, sizeof(file_name));
strlcat(file_name, att_file[index], sizeof(file_name));
fh = open(file_name, O_RDONLY | O_BINARY);
if (fh > 0)
{
do
{
n = read(fh, buffer, 45);
if (n<=0)
break;
base64_bufenc(buffer, n, str);
strcat(str, "\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
} while(1);
close(fh);
}
/* send boundary */
if (index < n_att-1)
snprintf(str, strsize - 1, "\r\n--%s\r\n", boundary);
else
snprintf(str, strsize - 1, "\r\n--%s--\r\n", boundary);
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
}
}
/* send ".<CR>" to signal end of message */
snprintf(str, strsize - 1, ".\r\n");
send(s, str, strlen(str), 0);
if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
snprintf(str, strsize - 1, "QUIT\r\n"); snprintf(str, strsize - 1, "QUIT\r\n");
send(s, str, strlen(str), 0); send(s, str, strlen(str), 0);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
recv_string(s, str, strsize, 3000); recv_string(s, str, strsize, 3000);
if (verbose) puts(str); if (verbose) fputs(str, stdout);
closesocket(s); closesocket(s);
free(str); free(str);
@ -6544,7 +6683,7 @@ int i, fh, size, self_register;
sprintf(url+strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name")); sprintf(url+strlen(url), "?cmd=Login&unm=%s", getparam("new_user_name"));
sprintf(mail_text+strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url); sprintf(mail_text+strlen(mail_text), "%s %s\r\n", loc("You can access it at"), url);
sendmail(smtp_host, mail_from, getparam("new_user_email"), subject, mail_text, TRUE, url); sendmail(lbs, smtp_host, mail_from, getparam("new_user_email"), subject, mail_text, TRUE, url, NULL);
} }
else else
{ {
@ -6610,7 +6749,7 @@ int i, fh, size, self_register;
loc("Logbook"), url, getparam("new_user_name"), pl); loc("Logbook"), url, getparam("new_user_name"), pl);
} }
sendmail(smtp_host, mail_from, email_addr, subject, mail_text, TRUE, url); sendmail(lbs, smtp_host, mail_from, email_addr, subject, mail_text, TRUE, url, NULL);
} }
pl = strtok(NULL, " ,"); pl = strtok(NULL, " ,");
@ -6930,7 +7069,7 @@ char str[1000], login_name[256], full_name[256], user_email[256], name[256], pwd
strlcat(mail_text, "\r\n\r\n", sizeof(mail_text)); strlcat(mail_text, "\r\n\r\n", sizeof(mail_text));
sprintf(mail_text+strlen(mail_text), "ELOG Version %s\r\n", VERSION); sprintf(mail_text+strlen(mail_text), "ELOG Version %s\r\n", VERSION);
if (sendmail(smtp_host, mail_from, user_email, subject, mail_text, TRUE, url) != -1) if (sendmail(lbs, smtp_host, mail_from, user_email, subject, mail_text, TRUE, url, NULL) != -1)
{ {
/* save new password */ /* save new password */
change_pwd(lbs, login_name, pwd_encrypted); change_pwd(lbs, login_name, pwd_encrypted);
@ -8007,7 +8146,7 @@ int i, n;
(getcfg(lbs->name, "Admin user", str) && strstr(str, getparam("unm")) != 0)) (getcfg(lbs->name, "Admin user", str) && strstr(str, getparam("unm")) != 0))
{ {
strcat(menu_str, "Admin, "); strcat(menu_str, "Admin, ");
strcat(menu_str, loc("Change elogd.cfg")); strcat(menu_str, "Change elogd.cfg");
strcat(menu_str, ", "); strcat(menu_str, ", ");
} }
strcat(menu_str, "Config, Logout, "); strcat(menu_str, "Config, Logout, ");
@ -8039,7 +8178,7 @@ int i, n;
if (strstr(admin_user, getparam("unm")) != NULL) if (strstr(admin_user, getparam("unm")) != NULL)
{ {
strcat(menu_str, loc("Change elogd.cfg")); strcat(menu_str, "Change elogd.cfg");
strcat(menu_str, ", "); strcat(menu_str, ", ");
} }
} }
@ -9635,9 +9774,9 @@ LOGBOOK *lbs_cur;
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
int compose_email(LOGBOOK *lbs, char *mail_to, int message_id, char attrib[MAX_N_ATTR][NAME_LENGTH], int compose_email(LOGBOOK *lbs, char *mail_to, int message_id, char attrib[MAX_N_ATTR][NAME_LENGTH],
char *mail_param, int old_mail) char *mail_param, int old_mail, char att_file[MAX_ATTACHMENTS][256])
{ {
int i, j, n; int i, j, n, flags;
char str[NAME_LENGTH+100], str2[256], mail_from[256], *mail_text, smtp_host[256], subject[256]; char str[NAME_LENGTH+100], str2[256], mail_from[256], *mail_text, smtp_host[256], subject[256];
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];
char list[MAX_PARAM][NAME_LENGTH], url[256], comment[256]; char list[MAX_PARAM][NAME_LENGTH], url[256], comment[256];
@ -9648,6 +9787,10 @@ char list[MAX_PARAM][NAME_LENGTH], url[256], comment[256];
return 0; return 0;
} }
flags = 31;
if (getcfg(lbs->name, "Email format", str))
flags = atoi(str);
if (getcfg(lbs->name, "Use Email from", mail_from)) if (getcfg(lbs->name, "Use Email from", mail_from))
{ {
j = build_subst_list(lbs, slist, svalue, attrib); j = build_subst_list(lbs, slist, svalue, attrib);
@ -9659,34 +9802,41 @@ char list[MAX_PARAM][NAME_LENGTH], url[256], comment[256];
sprintf(mail_from, "ELog@%s", host_name); sprintf(mail_from, "ELog@%s", host_name);
mail_text = malloc(TEXT_SIZE+1000); mail_text = malloc(TEXT_SIZE+1000);
mail_text[0] = 0;
if (old_mail) if (flags & 1)
sprintf(mail_text, loc("A old entry has been updated on %s"), host_name);
else
sprintf(mail_text, loc("A new entry has been submitted on %s"), host_name);
sprintf(mail_text+strlen(mail_text), "\r\n\r\n");
sprintf(mail_text+strlen(mail_text), "%s : %s\r\n", loc("Logbook"), lbs->name);
for (j=0 ; j<lbs->n_attr ; j++)
{ {
strcpy(str, " "); if (old_mail)
memcpy(str, attr_list[j], strlen(attr_list[j])); sprintf(mail_text+strlen(mail_text), loc("A old entry has been updated on %s"), host_name);
comment[0] = 0;
if (attr_flags[j] & AF_ICON)
{
sprintf(str2, "Icon comment %s", attrib[j]);
getcfg(lbs->name, str2, comment);
}
if (comment[0])
sprintf(str+20, ": %s\r\n", comment);
else else
sprintf(str+20, ": %s\r\n", attrib[j]); sprintf(mail_text+strlen(mail_text), loc("A new entry has been submitted on %s"), host_name);
strcpy(mail_text+strlen(mail_text), str); sprintf(mail_text+strlen(mail_text), "\r\n\r\n");
}
if (flags & 2)
{
sprintf(mail_text+strlen(mail_text), "%s : %s\r\n", loc("Logbook"), lbs->name);
for (j=0 ; j<lbs->n_attr ; j++)
{
strcpy(str, " ");
memcpy(str, attr_list[j], strlen(attr_list[j]));
comment[0] = 0;
if (attr_flags[j] & AF_ICON)
{
sprintf(str2, "Icon comment %s", attrib[j]);
getcfg(lbs->name, str2, comment);
}
if (comment[0])
sprintf(str+20, ": %s\r\n", comment);
else
sprintf(str+20, ": %s\r\n", attrib[j]);
strcpy(mail_text+strlen(mail_text), str);
}
} }
/* compose subject from attributes */ /* compose subject from attributes */
@ -9726,20 +9876,33 @@ char list[MAX_PARAM][NAME_LENGTH], url[256], comment[256];
} }
sprintf(url, "%s%d", str, message_id); sprintf(url, "%s%d", str, message_id);
sprintf(mail_text+strlen(mail_text), "\r\n%s URL : %s\r\n",
loc("Logbook"), url);
if (getcfg(lbs->name, "Email message body", str) && if (flags & 4)
atoi(str) == 1) {
sprintf(mail_text+strlen(mail_text), "\r\n%s URL : %s\r\n",
loc("Logbook"), url);
}
if (flags & 8)
{ {
sprintf(mail_text+strlen(mail_text), "\r\n=================================\r\n\r\n%s", sprintf(mail_text+strlen(mail_text), "\r\n=================================\r\n\r\n%s",
getparam("text")); getparam("text"));
} }
if (getcfg(lbs->name, "Omit Email to", str) && atoi(str) == 1) if (flags & 16)
sendmail(smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url); {
if (getcfg(lbs->name, "Omit Email to", str) && atoi(str) == 1)
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, att_file);
else
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, att_file);
}
else else
sendmail(smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url); {
if (getcfg(lbs->name, "Omit Email to", str) && atoi(str) == 1)
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, FALSE, url, NULL);
else
sendmail(lbs, smtp_host, mail_from, mail_to, subject, mail_text, TRUE, url, NULL);
}
if (!getcfg(lbs->name, "Display email recipients", str) || if (!getcfg(lbs->name, "Display email recipients", str) ||
atoi(str) == 1) atoi(str) == 1)
@ -10049,7 +10212,7 @@ int i, j, n, missing, first, index, mindex, suppress, message_id, resubmit_or
if (strlen(mail_to) > 0) if (strlen(mail_to) > 0)
{ {
mail_to[strlen(mail_to)-1] = 0; /* strip last ',' */ mail_to[strlen(mail_to)-1] = 0; /* strip last ',' */
if (compose_email(lbs, mail_to, message_id, attrib, mail_param, *getparam("edit_id")) == 0) if (compose_email(lbs, mail_to, message_id, attrib, mail_param, *getparam("edit_id"), att_file) == 0)
return; return;
} }