Runner_Mail() | PHPMailer() | PHP Mail() |
SMTP, user name, password, port, etc. are set inside the PHPRunner UI | PHPMailer() is called by Runner_Mail()
SMTP is set inside the PHP code itself |
SMTP is set in “PHP.ini” |
<?php
require_once(“include/dbcommon.php”);
$email = “t1@mobitek.my”; $msg = “”; $subject = “New data record”;
$msg.= “Message: [Message]\r\n”; $msg.= “Recipient: Recipient\r\n”; $msg.= “Date/Time: DateTimeQueue\r\n”; runner_mail(array(‘to’ => ‘$email’, ‘subject’ => $subject, ‘body’ => $msg)); ?> |
<?php include_once(‘libs/phpmailer/class.phpmailer.php’); include_once(‘libs/phpmailer/class.smtp.php’);$mail = new PHPMailer( true ); // Mail settings $mail->isSMTP(); //Send using SMTP $mail->Host = ‘mail.sweetco.com.my’; //Set the SMTP server to send through $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = ‘factory@sweetco.com.my‘; //SMTP username $mail->Password = ‘2022@Beranang@Factory’; //SMTP password //$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption $mail->Port = 587; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` $mail->setFrom(‘support@mobitek.my‘, ‘MOBITEK Support’); $mail->isHTML(false);$mail->To = “t1@mobitek.my”; $mail->Subject = “This is Subject”; $mail->Body = “This the body”; $mail->Send();?> |
Open “php.ini” and search for “smtp” (there are no entries for no username and password)
[mail function] ; For Win32 only. ; For Unix only. You may supply arguments as well (default: “sendmail -t -i”). ; Force the addition of the specified parameters to be passed as extra parameters ; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename ; The path to a log file that will log all mail() calls. Log entries include |