- Thu Apr 27, 2023 2:35 pm
#830546
Log in to the Processmaker 4.3 Community Bitnami Package with your credentials.
Go to the Processmaker Designer and select the process where you want to add the email notification.
Select the task where you want to add the email notification.
Click on the "Notifications" tab and select the "Email" notification type.
In the "To" field, select the user or group who should receive the email notification.
In the "Subject" and "Message" fields, enter the content of the email notification.
Click on the "Advanced" tab and select the "Script" option.
In the "Script" field, enter the code to send the email notification. You can use PHP's built-in mail function or a third-party email library such as PHPMailer to send the email.
require_once 'vendor/autoload.php';
// Create a new PHPMailer instance
$mail = new PHPMailer\PHPMailer\PHPMailer();
// Set the SMTP configuration
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = 'your-email@gmail.com';
$mail->Password = 'your-password';
// Set the email content
$mail->setFrom('your-email@gmail.com', 'Your Name');
$mail->addAddress('recipient-email@example.com', 'Recipient Name');
$mail->Subject = 'Notification: Your request is waiting for approval';
$mail->Body = 'Dear Recipient, your request is waiting for approval.';
// Send the email
if (!$mail->send()) {
throw new Exception('Error sending email: ' . $mail->ErrorInfo);
}
Note that you need to install the PHPMailer library using Composer or download it manually and include the autoload.php file at the beginning of your script.