این اسکریپت نیاز به ماژول pear دارد. لطفا قبل از اجرای این اسکریپت از نصب بودن آن اطمینان حاصل نمایید
<?php error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT); set_include_path(".". PATH_SEPARATOR .($UserDir = dirname($_SERVER['DOCUMENT_ROOT']))."/pear/php". PATH_SEPARATOR . get_include_path()); require_once "Mail.php"; $host ="SERVERNAME"; $username ="EMAILADDRESS"; $password ="PASSWORRRRRDDD"; $port ="465"; $to ="DESTIEMAIL"; $email_from ="MYEMAIL"; $email_subject ="Subject Line Here: "; $email_body ="whatever you like"; $email_address ="[email protected]"; $headers = array ('From'=> $email_from,'To'=> $to,'Subject'=> $email_subject,'Reply-To'=> $email_address); $smtp =Mail::factory('smtp', array ('host'=> $host,'port'=> $port,'auth'=>true,'username'=> $username,'password'=> $password)); $mail = $smtp->send($to, $headers, $email_body);if(PEAR::isError($mail)){ echo("<p>". $mail->getMessage()."</p>");}else{ echo("<p>Message successfully sent!</p>");}?>