A PHPMailer based mailing function with simplified email capabilities utilizing mysql for multi email host/account capabilities
Ability to use multiple existing mail systems like
Gmail
Yahoo
Rediffmail
etc.
Ability to define host/account switch limits (Switch email sender after one limit of that particular account is reached)
Single dashboard for setting/updating mail accounts/hosts.
Easy Integartion into existing systems
Refer to account_for_emails.sql
web root
account_for_emails.sql
in your databaseconn.php
to fit your needs.mailer.php
in required locations/files/scripts and use sendMail()
function.<?php
include "mailer.php";
@$toEmail = $_POST['email'];
@$toName = $_POST['name'];
@$message = $_POST['message'];
@$subject = $_POST['subject'];
@$replyToEmailAddress = $_POST['replyToEmailAddress'];
@$replyToName = $_POST['replyToName'];
if(!empty($toEmail)){
echo "Result: ";
if(sendMail($replyToEmailAddress, $replyToName, $toEmail, $toName, $subject, $message, $message, "")) {
echo "Email message sent.";
} else {
echo "<br><hr>Failed to send email.";
}
}
?>
$replyToEmailAddress: The email address that the recipient will reply to
$replyToName: The name that the recipient will see for the reply to address
$recieverEmailAddress: The email address of the recipient
$recieverName: The name that the recipient
$emailSubject: The subject of the email
$emailBody: The body of the email (HTML)
$alternateBody: The body of the email in Text format
$attachmentsPaths: An key-value pairs of fileNames to the filePaths to be attached in mail
Please refer to sample.php
Before using this function be informed that, I am not sure if it is formally approved by Google to use its SMTP server to send email in this way. I do not see any information prohibiting it either.
No longer suppoted since 30th May 2022
Less secure app access
by loging in to your Gmail account and then going to page https://myaccount.google.com/lesssecureapps and Turning this option On
.Other ways to sign in > App password
and click Generate and manage app passwords
Enter your App name
field and then click Generate Password
.password
in DB/Dashboard.Host:
smtp.gmail.com
Port:
587
SMTPSecure:
tls
email_limit:
500
Host:
smtp.mail.yahoo.com
Port:
587
SMTPSecure:
tls
email_limit:
500