1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 19:46:39 +02:00

Merge branch '2.0' into 2.1.

This commit is contained in:
Sadie Powell
2023-07-11 12:28:51 +01:00
12 changed files with 47 additions and 16 deletions
+18 -9
View File
@@ -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"))
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"))
{
}
@@ -35,17 +44,17 @@ void Mail::Message::Run()
return;
}
fprintf(pipe, "From: %s\n", send_from.c_str());
fprintf(pipe, "From: %s\r\n", send_from.c_str());
if (this->dont_quote_addresses)
fprintf(pipe, "To: %s <%s>\n", mail_to.c_str(), addr.c_str());
fprintf(pipe, "To: %s <%s>\r\n", mail_to.c_str(), addr.c_str());
else
fprintf(pipe, "To: \"%s\" <%s>\n", mail_to.c_str(), addr.c_str());
fprintf(pipe, "Subject: %s\n", subject.c_str());
fprintf(pipe, "Content-Type: text/plain; charset=UTF-8;\n");
fprintf(pipe, "Content-Transfer-Encoding: 8bit\n");
fprintf(pipe, "\n");
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: %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());
fprintf(pipe, "\n.\n");
fprintf(pipe, "\r\n.\r\n");
pclose(pipe);