From 6ba3fe4bf2cd77147c940cbbf1f738b7a7ec6de1 Mon Sep 17 00:00:00 2001 From: Sebastian Reichel Date: Sat, 5 Sep 2020 21:55:56 +0200 Subject: Fix missing To Header in mails The public interface expects internal type, which maps the enum differently. Specifically the internal RecipientType.TO is mapped to 0 for the internal code, but 0 means AddressType.Sender in GMime. As a result the supplied mail addresses end up in the Sender field instead. --- src/mail/mail.vala | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mail/mail.vala b/src/mail/mail.vala index f6cedc0..b863014 100644 --- a/src/mail/mail.vala +++ b/src/mail/mail.vala @@ -99,8 +99,16 @@ public class MailImplementation { } #endif - public void add_recipient(MailContact contact, GMime.AddressType type) throws DBusError, IOError { - m.add_mailbox(type, contact.name, contact.email); + public void add_recipient(MailContact contact, RecipientType type) throws DBusError, IOError { + GMime.AddressType gmime_type; + + switch(type) { + case RecipientType.BCC: gmime_type = GMime.AddressType.BCC; break; + case RecipientType.CC: gmime_type = GMime.AddressType.CC; break; + default: gmime_type = GMime.AddressType.TO; break; + } + + m.add_mailbox(gmime_type, contact.name, contact.email); recipients += contact.email; } -- cgit v1.2.3