Issue #50 - fix memory leaks

This commit is contained in:
Attila Tőkés 2017-06-01 19:14:20 +03:00
parent 6b676827fe
commit 5fc59c0863
2 changed files with 4 additions and 0 deletions

View File

@ -61,6 +61,7 @@ void MimeMessage::setContent(MimePart *content) {
void MimeMessage::setSender(EmailAddress* e) void MimeMessage::setSender(EmailAddress* e)
{ {
this->sender = e; this->sender = e;
e->setParent(this);
} }
void MimeMessage::addRecipient(EmailAddress* rcpt, RecipientType type) void MimeMessage::addRecipient(EmailAddress* rcpt, RecipientType type)
@ -77,6 +78,8 @@ void MimeMessage::addRecipient(EmailAddress* rcpt, RecipientType type)
recipientsBcc << rcpt; recipientsBcc << rcpt;
break; break;
} }
rcpt->setParent(this);
} }
void MimeMessage::addTo(EmailAddress* rcpt) { void MimeMessage::addTo(EmailAddress* rcpt) {

View File

@ -364,6 +364,7 @@ bool SmtpClient::sendMail(MimeMessage& email)
// To (primary recipients) // To (primary recipients)
for (it = email.getRecipients().begin(), itEnd = email.getRecipients().end(); for (it = email.getRecipients().begin(), itEnd = email.getRecipients().end();
it != itEnd; ++it) it != itEnd; ++it)
{
sendMessage("RCPT TO:<" + (*it)->getAddress() + ">"); sendMessage("RCPT TO:<" + (*it)->getAddress() + ">");
waitForResponse(); waitForResponse();