PicPoc Posted November 1, 2022 Share Posted November 1, 2022 Hi ! I want to sendmail from a php script in Apache-PHP. Is it possible ? Sendmail is on unRAID but not in the docker... Is there a way to bridge the docker and unRAID for sendmail? Quote Link to comment
pyrater Posted November 5, 2022 Share Posted November 5, 2022 use phpmailer. Has nothing to do with unraid. <?php // PHPMailer classes into the global namespace use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; // Base files require '../PHPMailer/src/Exception.php'; require '../PHPMailer/src/PHPMailer.php'; require '../PHPMailer/src/SMTP.php'; // create object of PHPMailer class with boolean parameter which sets/unsets exception. $mail = new PHPMailer(true); try { $mail->isSMTP(); // using SMTP protocol $mail->Host = 'smtp.gmail.com'; // SMTP host as gmail $mail->SMTPAuth = true; // enable smtp authentication $mail->Username = '[email protected]'; // sender gmail host $mail->Password = '234wdef@@$AE'; // sender gmail host password $mail->SMTPSecure = 'tls'; // for encrypted connection $mail->Port = 587; // port for SMTP $mail->setFrom('[email protected]', "Sender"); // sender's email and name $mail->addAddress('[email protected]', "Receiver"); // receiver's email and name $mail->AddCC('[email protected]', 'Person Two'); $mail->Subject = 'Test email'; $mail->Body = 'Hello World.'; $mail->send(); echo 'Message has been sent'; } catch (Exception $e) { // handle error. echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo; } ?> Quote Link to comment
PicPoc Posted November 6, 2022 Author Share Posted November 6, 2022 (edited) Thanks, but : I saw "phpmailer" but composer is needed ? And may be sendmail. But sendmail is not present on Apache-PHP... Edited November 6, 2022 by PicPoc Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.