OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
Xpress_backup
/
vendor
/
phpmailer
/
phpmailer
/
examples
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:17 AM
rwxr-xr-x
📄
DKIM_gen_keys.phps
3.32 KB
01/06/2025 08:12:46 AM
rw-r--r--
📄
DKIM_sign.phps
1.77 KB
01/06/2025 08:12:46 AM
rw-r--r--
📄
README.md
8 KB
01/06/2025 08:12:47 AM
rw-r--r--
📄
azure_xoauth2.phps
4.08 KB
01/06/2025 08:12:44 AM
rw-r--r--
📄
callback.phps
2.31 KB
01/06/2025 08:12:44 AM
rw-r--r--
📄
contactform-ajax.phps
5.14 KB
01/06/2025 08:12:45 AM
rw-r--r--
📄
contactform.phps
3.61 KB
01/06/2025 08:12:45 AM
rw-r--r--
📄
contents.html
585 bytes
01/06/2025 08:12:45 AM
rw-r--r--
📄
contentsutf8.html
1.15 KB
01/06/2025 08:12:45 AM
rw-r--r--
📄
exceptions.phps
1.66 KB
01/06/2025 08:12:46 AM
rw-r--r--
📄
extending.phps
2.63 KB
01/06/2025 08:12:46 AM
rw-r--r--
📄
gmail.phps
3.76 KB
01/06/2025 08:12:47 AM
rw-r--r--
📄
gmail_xoauth.phps
3.91 KB
01/06/2025 08:12:47 AM
rw-r--r--
📁
images
-
01/06/2025 08:24:58 AM
rwxr-xr-x
📄
mail.phps
1.15 KB
01/06/2025 08:12:47 AM
rw-r--r--
📄
mailing_list.phps
3.21 KB
01/06/2025 08:12:47 AM
rw-r--r--
📄
pop_before_smtp.phps
2.43 KB
01/06/2025 08:12:47 AM
rw-r--r--
📄
send_file_upload.phps
2.08 KB
01/06/2025 08:12:48 AM
rw-r--r--
📄
send_multiple_file_upload.phps
2.04 KB
01/06/2025 08:12:48 AM
rw-r--r--
📄
sendmail.phps
1.22 KB
01/06/2025 08:12:48 AM
rw-r--r--
📄
sendoauth2.phps
4.57 KB
01/06/2025 08:12:48 AM
rw-r--r--
📄
simple_contact_form.phps
3.91 KB
01/06/2025 08:12:49 AM
rw-r--r--
📄
smime_signed_mail.phps
4.28 KB
01/06/2025 08:12:49 AM
rw-r--r--
📄
smtp.phps
2.25 KB
01/06/2025 08:12:49 AM
rw-r--r--
📄
smtp_check.phps
2.07 KB
01/06/2025 08:12:49 AM
rw-r--r--
📄
smtp_low_memory.phps
4.93 KB
01/06/2025 08:12:50 AM
rw-r--r--
📄
smtp_no_auth.phps
1.87 KB
01/06/2025 08:12:50 AM
rw-r--r--
📄
ssl_options.phps
2.36 KB
01/06/2025 08:12:50 AM
rw-r--r--
Editing: mailing_list.phps
Close
<?php /** * This example shows how to send a message to a whole list of recipients efficiently. */ //Import the PHPMailer class into the global namespace use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; error_reporting(E_STRICT | E_ALL); date_default_timezone_set('Etc/UTC'); require '../vendor/autoload.php'; //Passing `true` enables PHPMailer exceptions $mail = new PHPMailer(true); $body = file_get_contents('contents.html'); $mail->isSMTP(); $mail->Host = 'smtp.example.com'; $mail->SMTPAuth = true; $mail->SMTPKeepAlive = true; //SMTP connection will not close after each email sent, reduces SMTP overhead $mail->Port = 25; $mail->Username = 'yourname@example.com'; $mail->Password = 'yourpassword'; $mail->setFrom('list@example.com', 'List manager'); $mail->addReplyTo('list@example.com', 'List manager'); $mail->addCustomHeader( 'List-Unsubscribe', '<mailto:unsubscribes@example.com>, <https://www.example.com/unsubscribe.php>' ); $mail->Subject = 'PHPMailer Simple database mailing list test'; //Same body for all messages, so set this before the sending loop //If you generate a different body for each recipient (e.g. you're using a templating system), //set it inside the loop $mail->msgHTML($body); //msgHTML also sets AltBody, but if you want a custom one, set it afterwards $mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; //Connect to the database and select the recipients from your mailing list that have not yet been sent to //You'll need to alter this to match your database $mysql = mysqli_connect('localhost', 'username', 'password'); mysqli_select_db($mysql, 'mydb'); $result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = FALSE'); foreach ($result as $row) { try { $mail->addAddress($row['email'], $row['full_name']); } catch (Exception $e) { echo 'Invalid address skipped: ' . htmlspecialchars($row['email']) . '<br>'; continue; } if (!empty($row['photo'])) { //Assumes the image data is stored in the DB $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); } $mail->replaceCustomHeader( 'List-Unsubscribe', '<mailto:unsubscribes@example.com>, <https://www.example.com/unsubscribe.php?email=' . rawurlencode($row['email']) . '>' ); try { $mail->send(); echo 'Message sent to :' . htmlspecialchars($row['full_name']) . ' (' . htmlspecialchars($row['email']) . ')<br>'; //Mark it as sent in the DB mysqli_query( $mysql, "UPDATE mailinglist SET sent = TRUE WHERE email = '" . mysqli_real_escape_string($mysql, $row['email']) . "'" ); } catch (Exception $e) { echo 'Mailer Error (' . htmlspecialchars($row['email']) . ') ' . $mail->ErrorInfo . '<br>'; //Reset the connection to abort sending this message //The loop will continue trying to send to the rest of the list $mail->getSMTPInstance()->reset(); } //Clear all addresses and attachments for the next iteration $mail->clearAddresses(); $mail->clearAttachments(); }