aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/sendmail
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2003-02-23 09:23:43 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2003-02-23 09:23:43 +0800
commita9d623d22fdcf65d759e968f51c33234ac63b60d (patch)
tree109672ef61bdb82756a5328292b9a61eba5b1dde /camel/providers/sendmail
parent9e2cde2a1da215fdc8a5e451e4f93ba8761a4420 (diff)
downloadgsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.gz
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.bz2
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.lz
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.xz
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.tar.zst
gsoc2013-evolution-a9d623d22fdcf65d759e968f51c33234ac63b60d.zip
Remove all Bcc headers before sending to the smtp server.
2003-02-22 Jeffrey Stedfast <fejj@ximian.com> * providers/smtp/camel-smtp-transport.c (smtp_data): Remove all Bcc headers before sending to the smtp server. * providers/sendmail/camel-sendmail-transport.c (sendmail_send_to): Remove all Bcc headers before sending to sendmail. svn path=/trunk/; revision=20000
Diffstat (limited to 'camel/providers/sendmail')
-rw-r--r--camel/providers/sendmail/camel-sendmail-transport.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/camel/providers/sendmail/camel-sendmail-transport.c b/camel/providers/sendmail/camel-sendmail-transport.c
index 1af237f239..58993da96d 100644
--- a/camel/providers/sendmail/camel-sendmail-transport.c
+++ b/camel/providers/sendmail/camel-sendmail-transport.c
@@ -87,10 +87,12 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
{
const char *from_addr, *addr, **argv;
int i, len, fd[2], nullfd, wstat;
+ struct _header_raw *header;
+ GSList *n, *bcc = NULL;
sigset_t mask, omask;
CamelStream *out;
pid_t pid;
-
+
if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &from_addr))
return FALSE;
@@ -115,12 +117,26 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
argv[i + 5] = NULL;
+ /* copy and remove the bcc headers */
+ header = CAMEL_MIME_PART (message)->headers;
+ while (header) {
+ if (!strcasecmp (header->name, "Bcc"))
+ bcc = g_slist_append (bcc, g_strdup (header->value));
+ header = header->next;
+ }
+
+ n = bcc;
+ while (n) {
+ camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
+ n = n->next;
+ }
+
if (pipe (fd) == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Could not create pipe to sendmail: "
"%s: mail not sent"),
g_strerror (errno));
- return FALSE;
+ goto exception;
}
/* Block SIGCHLD so the calling application doesn't notice
@@ -139,7 +155,8 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
g_strerror (errno));
sigprocmask (SIG_SETMASK, &omask, NULL);
g_free (argv);
- return FALSE;
+
+ goto exception;
case 0:
/* Child process */
nullfd = open ("/dev/null", O_RDWR);
@@ -170,7 +187,7 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
sigprocmask (SIG_SETMASK, &omask, NULL);
- return FALSE;
+ goto exception;
}
camel_object_unref (CAMEL_OBJECT (out));
@@ -181,6 +198,15 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
sigprocmask (SIG_SETMASK, &omask, NULL);
+ /* add the bcc headers back */
+ while (bcc) {
+ n = bcc->next;
+ camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data);
+ g_free (bcc->data);
+ g_slist_free1 (bcc);
+ bcc = n;
+ }
+
if (!WIFEXITED (wstat)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("sendmail exited with signal %s: "
@@ -203,6 +229,17 @@ sendmail_send_to (CamelTransport *transport, CamelMimeMessage *message,
}
return TRUE;
+
+ exception:
+
+ /* add the bcc headers back */
+ while (bcc) {
+ n = bcc->next;
+ camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", bcc->data);
+ g_free (bcc->data);
+ g_slist_free1 (bcc);
+ bcc = n;
+ }
}
static char *