void TMailProcessor::Send(const TIdentity& senderId, const TPhysicalMailMessage& msg) { TPhysicalMailMessage msgToSend(msg); TRecipientPublicKeys bccList(msg.bcc_list); /// \warning Message to be sent must have cleared bcc list. msgToSend.bcc_list.clear(); size_t totalRecipientCount = msgToSend.to_list.size() + msgToSend.cc_list.size() + bccList.size(); //Sink.OnMessageGroupPending(totalRecipientCount); //Sink.OnMessagePending auto my_priv_key = Profile->get_keychain().get_identity_key(senderId.dac_id_string); auto app = bts::application::instance(); for(const auto& public_key : msgToSend.to_list) app->send_email(msgToSend, public_key, my_priv_key); for(const auto& public_key : msgToSend.cc_list) app->send_email(msgToSend, public_key, my_priv_key); for(const auto& public_key : bccList) app->send_email(msgToSend, public_key, my_priv_key); }
bool TConnectionProcessor::TOutboxQueue::transferMessage(const TRecipientPublicKey& senderId, const TPhysicalMailMessage& msg) { bool sendStatus = false; try { bts::extended_private_key senderPrivKey; if(findIdentityPrivateKey(senderId, &senderPrivKey)) { TPhysicalMailMessage msgToSend(msg); TRecipientPublicKeys bccList(msg.bcc_list); /// \warning Message to be sent must have cleared bcc list. msgToSend.bcc_list.clear(); size_t totalRecipientCount = msgToSend.to_list.size() + msgToSend.cc_list.size() + bccList.size(); for(const auto& public_key : msgToSend.to_list) { if(isCancelled()) return false; sendMail(msgToSend, public_key, senderPrivKey); } for(const auto& public_key : msgToSend.cc_list) { if(isCancelled()) return false; sendMail(msgToSend, public_key, senderPrivKey); } for(const auto& public_key : bccList) { if(isCancelled()) return false; sendMail(msgToSend, public_key, senderPrivKey); } sendStatus = true; } else { Processor.Sink->OnMissingSenderIdentity(senderId, msg); sendStatus = false; } } catch(const fc::exception& e) { sendStatus = false; elog("${e}", ("e", e.to_detail_string())); /// Probably connection related error, try to start it again checkForAvailableConnection(); } return sendStatus; }