npashitha Posted December 6, 2012 Share Posted December 6, 2012 (edited) Hi I want to send mail wih authentication details.I used th script below <?php if(isset($_POST['submit'])){ require_once "Mail.php"; $from = "Info <[email protected]>"; $to = "Ash <[email protected]>"; $subject = "Test email using PHP SMTP\r\n\r\n"; $body = "This is a test email message"; $host = "mail.domainname.com"; $username = "[email protected]"; $password = "xxxxxx"; $port =25; $headers = array ('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array ('host' => $host,'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password )); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } } ?> PEAR module is already installed in the server.I am getting an error like Fatal error: Call to undefined method PEAR_Error::send(). Any suggestions? Edited December 6, 2012 by PFMaBiSmAd removed wysiwyg micro-font format Quote Link to comment https://forums.phpfreaks.com/topic/271667-sending-mail-with-authentication-details/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.