But the paths to the included files have to be changed, because your PHP file can have a whatever name and be placed in whatever path that is accessible for you. See, that the namespaces don't change, because namespaces are still the same no matter what file structure you have. Require_once './PHPMailer/src/SMTP.php' įunction send_mail($to_address, $from_address, $from_name, $email_subject, $email_body) Name the file phpmailer.php and click Create. Click on the publichtml folder and select Add New to create a new file. Require_once './PHPMailer/src/Exception.php' Access the hPanel dashboard and navigate to Files File Manager. Require_once './PHPMailer/src/PHPMailer.php' Inc/mail.php use PHPMailer\PHPMailer\PHPMailer P.S.: the directory structure is as follows:īy the given information you should be able do solve your problem with this solution: Lead Generation with Automated Cold Emails Automailer is a cold email automation tool that is designed specifically for lead generation. What's the correct way to use the namespace statements inside the function? And/or is there a better way to solve the problem? Mail.php function send_mail($to_address, $from_address, $from_name, $email_subject, $email_body) Send_mail($to_address, $from_address, $from_name, $email_subject, $email_body) We suggest you first use an email testing tool such as Mailtrap Email Testing and its SMTP server to test the functionality before sending anything to real recipients. Features: - Runs in systray - Sends new or modified files only (optional) - Saves copies of mailed files (optional) - Deletes sent files (optional) - User-defined time in sec. Test2.php use PHPMailer\PHPMailer\PHPMailer For PHPMailer to be able to send emails from your PHP app, you will need to connect it to an SMTP server. AutoMailer periodically polls this directory and sends the files as to the criteria specified. */īut when I try to turn the mailing part into a function, saved in an external file (here, mail.php), I get into trouble, with an "HTTP ERROR 500" I suppose it's because of the namespace, that is not correctly seen by the new PHPMailer(TRUE) statement inside the function. * SMTP class, needed if you want to use SMTP. Test.php use PHPMailer\PHPMailer\PHPMailer I've managed to have it working fine, without using the autoload but using namespace instead: Triggers when an email is forwarded to your own custom address. I'm swapping php mail() function with PHPMailer, in order to use SMTP authentication. Zapier lets you send info between Email by Zapier and MySQL automaticallyno code required.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |