From 0d317dc0cfe6ae2b6b62d711b7ae67e63555235f Mon Sep 17 00:00:00 2001 From: Geo Xalkis Date: Sun, 2 Apr 2023 06:16:40 +0300 Subject: several updates on user registration --- html/app/extends/Send_mail.php | 157 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 html/app/extends/Send_mail.php (limited to 'html/app/extends/Send_mail.php') diff --git a/html/app/extends/Send_mail.php b/html/app/extends/Send_mail.php new file mode 100644 index 0000000..c3ecb66 --- /dev/null +++ b/html/app/extends/Send_mail.php @@ -0,0 +1,157 @@ +SMTPDebug = 3; + $mail->IsSMTP(); + $mail->Host = MAIL_HOST; + $mail->SMPTAuth = true; + $mail->SMTPSecure = MAIL_ENCRYPTION; + // $mail->Protocol = 'mail'; + + // $mail->Mailer = MAIL_MAILER; + $mail->Port = MAIL_PORT; + $mail->Username = MAIL_USERNAME; + $mail->Password = MAIL_PASSWORD; + + return $mail; + } + + + /** + * + */ + private static function init_slack() + { + + } + + + /** + * + * @param $envelope (array): mail from/to and activation code + * + * TODO: + * check for email templating: + * + https://stackoverflow.com/questions/2391171/how-to-get-output-from-local-script-in-php + * + https://stackoverflow.com/questions/171318/how-do-i-capture-php-output-into-a-variable + */ + public static function send_activation_code($envelope) + { + $mail = self::init_mail(); + + // setup format + $mail->CharSet = 'utf-8'; + $mail->IsHTML(true); + + // setup THE mail + // --- -- -- - - - + // It's important not to use the submitter's address as the from address as it's forgery, + // which will cause your messages to fail SPF checks. + // Use an address in your own domain as the from address, put the submitter's address in a reply-to + $mail->setFrom(NO_REPLY_EMAIL, SITE_TITLE); + $mail->addAddress($envelope['email'], $envelope['name']); + $mail->addReplyTo(REPLY_TO_EMAIL, SITE_TITLE); + $mail->AddBCC("piipiis@gmail.com", "tester"); // notifiation email while testing + $mail->Subject = 'Εγγραφή στο Classroom'; + $mail->Body = "Χαίρετε,
+ το παρόν αυτοποιημένο email σάς έχει σταλεί γιατί έχει γίνει αίτημα εγγραφής σας στο Classroom.
+
+ Όνομα επαφής: ". $envelope['name'] ."
+ Email : ". $envelope['email'] ."
+
+ Για να ενεργοποιήσετε την πρόσβασή σας στο site θα πρέπει να παρακαλώ πατήστε στον + παρακάτω σύνδεσμο url + . +
+
+ Μετά την ενεργοποίηση θα έχετε πρόσσβαση στο περιεχόμενο του site.
+
+ Μην απαντήσετε στο email γιατί δεν υπάρχει φυσική επαφή η οποία να λαμβάνει τυχόν replies.
"; + if (!$mail->send()) { + return false; + } else { + return true; + } + + } +} + + + + + +/** + * + * + +Optimization per concept alternative technologies +--- -- -- - - - + +## Session +File Session +Database Session +Redis Session +Memcached Session + +--- + +## Cache +File Cache +Database Cache +Redis Cache +Memcashed Cache + +--- + +## Log +File Log +Database Log +Log event to Slack +Log event to Email + + * + * + */ + +/** custom email api + * + * host : https://api.roptron.gr + * apikey : md5(hash)-substring(0,5, md5(service)) 8668d1c4a8f5aba236a8f821d148340f-0c83f + * message : serialize([ + * from[email] => from name + * replyTo[email] => reply-to-Name + * to => [ + * email => email-name + * secondemail => another email name + * ] + * type => html + * charset => utf8 + * subject => mail subject + * mailBody => html string + * ]) + * + */ + +/** Several custom APIs + * + * Mailer + * + * sendpulse + * rU8WEmcHsRcEQaH + * rU8WEmcHsRcEQaH + * + */ + \ No newline at end of file -- cgit v1.2.3