Skip to content

Commit 700f769

Browse files
committed
Add Reply-To header support
1 parent 5da1857 commit 700f769

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/mimemessage.cpp

+16
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ void MimeMessage::setSender(const EmailAddress &sender)
5959
this->sender = sender;
6060
}
6161

62+
void MimeMessage::setReplyTo(const EmailAddress &replyTo)
63+
{
64+
this->replyTo = replyTo;
65+
}
66+
6267
void MimeMessage::addRecipient(const EmailAddress &rcpt, RecipientType type)
6368
{
6469
switch (type)
@@ -114,6 +119,11 @@ EmailAddress MimeMessage::getSender() const
114119
return sender;
115120
}
116121

122+
EmailAddress MimeMessage::getReplyTo() const
123+
{
124+
return replyTo;
125+
}
126+
117127
const QList<EmailAddress> & MimeMessage::getRecipients(RecipientType type) const
118128
{
119129
switch (type)
@@ -193,6 +203,12 @@ void MimeMessage::writeToDevice(QIODevice &out) const {
193203
header.append("From:" + formatAddress(sender, hEncoding) + "\r\n");
194204
/* ---------------------------------- */
195205

206+
/* ---------- Reply-To ----------- */
207+
if (!replyTo.getAddress().isEmpty()) {
208+
header.append("Reply-To:" + formatAddress(replyTo, hEncoding) + "\r\n");
209+
}
210+
/* ---------------------------------- */
211+
196212
/* ------- Recipients / To ---------- */
197213
header.append("To:");
198214
for (int i = 0; i<recipientsTo.size(); ++i)

src/mimemessage.h

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ class SMTP_MIME_EXPORT MimeMessage : public QObject
4949
/* [2] Getters and Setters */
5050

5151
void setSender(const EmailAddress &sndr);
52+
void setReplyTo(const EmailAddress &repto);
5253
void addRecipient(const EmailAddress &rcpt, RecipientType type = To);
5354
void addTo(const EmailAddress &rcpt);
5455
void addCc(const EmailAddress &rcpt);
@@ -60,6 +61,7 @@ class SMTP_MIME_EXPORT MimeMessage : public QObject
6061
void setHeaderEncoding(MimePart::Encoding);
6162

6263
EmailAddress getSender() const;
64+
EmailAddress getReplyTo() const;
6365
const QList<EmailAddress> &getRecipients(RecipientType type = To) const;
6466
QString getSubject() const;
6567
const QStringList &getCustomHeaders() const;
@@ -82,6 +84,7 @@ class SMTP_MIME_EXPORT MimeMessage : public QObject
8284
/* [4] Protected members */
8385

8486
EmailAddress sender;
87+
EmailAddress replyTo;
8588
QList<EmailAddress> recipientsTo, recipientsCc, recipientsBcc;
8689
QString subject;
8790
QStringList customHeaders;

0 commit comments

Comments
 (0)