aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers/smtp/camel-smtp-transport.c
diff options
context:
space:
mode:
Diffstat (limited to 'camel/providers/smtp/camel-smtp-transport.c')
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 54eecebde7..48972445e1 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -1002,7 +1002,7 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlffilter));
camel_object_unref (CAMEL_OBJECT (crlffilter));
- /* copy the bcc headers */
+ /* copy and remove the bcc headers */
header = CAMEL_MIME_PART (message)->headers;
while (header) {
if (!g_strcasecmp (header->name, "Bcc"))
@@ -1012,8 +1012,21 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi
camel_medium_remove_header (CAMEL_MEDIUM (message), "Bcc");
+ /* write the message */
ret = camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), CAMEL_STREAM (filtered_stream));
- if (ret == -1 || camel_stream_flush (CAMEL_STREAM (filtered_stream)) == -1) {
+
+ /* add the bcc headers back */
+ if (bcc) {
+ h = bcc;
+ while (h) {
+ camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data);
+ g_free (h->data);
+ h = h->next;
+ }
+ g_slist_free (bcc);
+ }
+
+ if (ret == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("DATA send timed out: message termination: "
"%s: mail not sent"),
@@ -1021,29 +1034,11 @@ smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bi
camel_object_unref (CAMEL_OBJECT (filtered_stream));
- if (bcc) {
- h = bcc;
- while (h) {
- camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data);
- g_free (h->data);
- h = h->next;
- }
- g_slist_free (bcc);
- }
-
return FALSE;
}
+ camel_stream_flush (CAMEL_STREAM (filtered_stream));
camel_object_unref (CAMEL_OBJECT (filtered_stream));
- if (bcc) {
- h = bcc;
- while (h) {
- camel_medium_add_header (CAMEL_MEDIUM (message), "Bcc", h->data);
- g_free (h->data);
- h = h->next;
- }
- g_slist_free (bcc);
- }
/* terminate the message body */