anope

- supernets anope source code & configuration
git clone git://git.acid.vegas/anope.git
Log | Files | Refs | Archive | README

mail.h (1577B)

      1 /*
      2  *
      3  * (C) 2003-2022 Anope Team
      4  * Contact us at team@anope.org
      5  *
      6  * Please read COPYING and README for further details.
      7  *
      8  * Based on the original code of Epona by Lara.
      9  * Based on the original code of Services by Andy Church.
     10  */
     11 
     12 #ifndef MAIL_H
     13 #define MAIL_H
     14 
     15 #include "anope.h"
     16 #include "threadengine.h"
     17 #include "serialize.h"
     18 
     19 namespace Mail
     20 {
     21 	extern CoreExport bool Send(User *from, NickCore *to, BotInfo *service, const Anope::string &subject, const Anope::string &message);
     22 	extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message);
     23 	extern CoreExport bool Validate(const Anope::string &email);
     24 
     25 	/* A email message being sent */
     26 	class Message : public Thread
     27 	{
     28 	 private:
     29 		Anope::string sendmail_path;
     30 		Anope::string send_from;
     31 		Anope::string mail_to;
     32 		Anope::string addr;
     33 		Anope::string subject;
     34 		Anope::string message;
     35 		bool dont_quote_addresses;
     36 
     37 		bool success;
     38 	 public:
     39 		/** Construct this message. Once constructed call Thread::Start to launch the mail sending.
     40 		 * @param sf Config->SendFrom
     41 		 * @param mailto Name of person being mailed (u->nick, nc->display, etc)
     42 		 * @param addr Destination address to mail
     43 		 * @param subject Message subject
     44 		 * @param message The actual message
     45 		 */
     46 		Message(const Anope::string &sf, const Anope::string &mailto, const Anope::string &addr, const Anope::string &subject, const Anope::string &message);
     47 
     48 		~Message();
     49 
     50 		/* Called from within the thread to actually send the mail */
     51 		void Run() anope_override;
     52 	};
     53 
     54 } // namespace Mail
     55 
     56 #endif // MAIL_H