Skip to content

Commit

Permalink
Send a BCC to self if the user wishes
Browse files Browse the repository at this point in the history
This is an alternative to storing the outgoing emails in a maildir.
  • Loading branch information
wereHamster committed May 17, 2012
1 parent 34be782 commit 5aa2a1d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/email_edit_view.cc
Expand Up @@ -143,6 +143,13 @@ void EmailEditView::send()
g_object_unref(multipart);
}

if (_identity->sendCopyToSelf) {
InternetAddress * userAddress = internet_address_mailbox_new(_identity->name.c_str(), _identity->email.c_str());
InternetAddressList * bcc = g_mime_message_get_recipients(message, GMIME_RECIPIENT_TYPE_BCC);
internet_address_list_add(bcc, userAddress);
g_object_unref(userAddress);
}

/* Send the message */
std::string sendCommand = _identity->sendCommand.empty() ?
NerConfig::instance().command("send") : _identity->sendCommand;
Expand Down
4 changes: 4 additions & 0 deletions src/identity_manager.cc
Expand Up @@ -29,6 +29,7 @@ void operator>>(const YAML::Node & node, Identity & identity)

/* Optional entries */
const YAML::Node * signatureNode = node.FindValue("signature");
const YAML::Node * sendCopyToSelfNode = node.FindValue("bcc");
const YAML::Node * sendNode = node.FindValue("send");
const YAML::Node * sentMailNode = node.FindValue("sent_mail");

Expand All @@ -37,6 +38,9 @@ void operator>>(const YAML::Node & node, Identity & identity)
else
identity.signaturePath.clear();

if (sendCopyToSelfNode)
*sendCopyToSelfNode >> identity.sendCopyToSelf;

if (sendNode)
*sendNode >> identity.sendCommand;

Expand Down
3 changes: 3 additions & 0 deletions src/identity_manager.hh
Expand Up @@ -31,7 +31,10 @@ struct Identity
std::string name;
std::string email;
std::string signaturePath;

bool sendCopyToSelf;
std::string sendCommand;

std::shared_ptr<MailStore> sentMail;
};

Expand Down

0 comments on commit 5aa2a1d

Please sign in to comment.