npashitha Posted December 6, 2012 Share Posted December 6, 2012 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? Link to comment https://forums.phpfreaks.com/topic/271667-sending-mail-with-authentication-details/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.