summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-07-09 14:39:51 +0100
committerSadie Powell <sadie@witchery.services>2023-07-09 14:39:51 +0100
commit14204353ac1474476c621a293e82b1f870b89661 (patch)
tree2fe667c5df8915706f657faf7f84e9eb2021a90e /src
parent098f19c005eb468654a4b2503bf6ffed17a5cfc2 (diff)
Allow customising the email content type.
This will allow people to send emails using HTML or non UTF-8 text.
Diffstat (limited to 'src')
-rw-r--r--src/mail.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/mail.cpp b/src/mail.cpp
index 4027e44f0..ca6edcffa 100644
--- a/src/mail.cpp
+++ b/src/mail.cpp
@@ -13,7 +13,16 @@
#include "mail.h"
#include "config.h"
-Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m) : Thread(), sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath")), send_from(sf), mail_to(mailto), addr(a), subject(s), message(m), dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses")), success(false)
+Mail::Message::Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &a, const Anope::string &s, const Anope::string &m)
+ : Thread()
+ , sendmail_path(Config->GetBlock("mail")->Get<const Anope::string>("sendmailpath"))
+ , send_from(sf), mail_to(mailto)
+ , addr(a)
+ , subject(s)
+ , message(m)
+ , content_type(Config->GetBlock("mail")->Get<const Anope::string>("content_type", "text/plain; charset=UTF-8"))
+ , dont_quote_addresses(Config->GetBlock("mail")->Get<bool>("dontquoteaddresses"))
+ , success(false)
{
}
@@ -41,7 +50,7 @@ void Mail::Message::Run()
else
fprintf(pipe, "To: \"%s\" <%s>\r\n", mail_to.c_str(), addr.c_str());
fprintf(pipe, "Subject: %s\r\n", subject.c_str());
- fprintf(pipe, "Content-Type: text/plain; charset=UTF-8;\r\n");
+ fprintf(pipe, "Content-Type: %s\r\n", content_type.c_str());
fprintf(pipe, "Content-Transfer-Encoding: 8bit\r\n");
fprintf(pipe, "\r\n");
fprintf(pipe, "%s", message.c_str());