Could Not Instantiate Mail Function Phpmailer Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss could not instantiate mail function wordpress the workings and policies of this site About Us Learn more about
Phpmailer Could Not Instantiate Mail Function Windows
Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow wordpress phpmailer could not instantiate mail function Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each could not instantiate mail function. joomla other. Join them; it only takes a minute: Sign up phpmailer ERROR :Could not instantiate mail function up vote 0 down vote favorite I am using localhost WAMP server (Windows) for webhosting. I am getting the following error. phpmailer ERROR :Could not instantiate mail function. I have tried many solutions but nothing worked for me. PHP mailing script
Codeigniter Could Not Instantiate Mail Function
$mailer = new PHPMailer(); $mailer->IsMAIL(); $mailer->CharSet = 'utf-8'; $mailer->AddAddress($formvars['email'],$formvars['name']); $mailer->Subject = "Your registration with ".$this->sitename; $mailer->From = $this->GetFromAddress(); $confirmcode = $formvars['confirmcode']; $confirm_url = $this->GetAbsoluteURLFolder().'/confirmreg.php?code='.$confirmcode; $mailer->Body ="Hello ".$formvars['name']."\r\n\r\n". "Thanks for your registration with ".$this->sitename."\r\n". "Please click the link below to confirm your registration.\r\n". "$confirm_url\r\n". "\r\n". "Regards,\r\n". "Webmaster\r\n". $this->sitename; if(!$mailer->Send()) { $this->HandleError("Failed sending registration confirmation email.".$mailer->ErrorInfo); //echo "Mailer Error: " . $mailer->ErrorInfo; return false; } return true; How do I diagnose this error? php email phpmailer share|improve this question edited Dec 24 '15 at 18:43 Bijan 2,65542147 asked Jun 4 '15 at 15:49 tarun14110 3191415 1 Did you require_once ('your_path/phpmailer/PHPMailerAutoload.php');? –Jonatas Walker Jun 4 '15 at 15:53 Has $formvars array been properly set? –Adam T Jun 4 '15 at 16:03 Souds like it is error-ing out on IsMail() which uses PHP's built in mail function. Have you verified that your php.ini mail settings and sendmail (if you are using that) are setup properly? –jnthnjns Jun 4 '15 at 16:11 @jonataswalker not including PHPMailer would give a class n
Support Search GitHub This repository Watch 640 Star 7,166 Fork 4,114 PHPMailer/PHPMailer Code Issues 52 Pull mailer error could not instantiate mail function. chronoforms requests 10 Projects 0 Wiki Pulse Graphs New issue Could could not instantiate mail function localhost not instantiate mail function. Message could not be sent.Mailer Error: Could not instantiate mail function. #508
Could Not Instantiate Mail Function Mailpoet
Closed ricksherm opened this Issue Sep 24, 2015 · 2 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 3 participants ricksherm http://stackoverflow.com/questions/30648462/phpmailer-error-could-not-instantiate-mail-function commented Sep 24, 2015 example.php error message: "Could not instantiate mail function. Message could not be sent.Mailer Error: Could not instantiate mail function." SMTPDebug = 3; // Enable verbose debug output // $mail->isSMTP(); // Set mailer to use SMTP $mail->CharSet="iso-8859-1"; $mail->Host = 'smtp.netins.net'; // Specify main and https://github.com/PHPMailer/PHPMailer/issues/508 backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'myname'; // SMTP username $mail->Password = 'mypassword'; // SMTP password $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted $mail->Port = 587; // TCP port to connect to $mail->From = 'from@example.com'; $mail->FromName = 'Mailer'; $mail->addAddress('ricksherman@netins.net'); // Add a recipient $mail->addReplyTo('info@example.com'); $mail->addCC('cc@example.com'); $mail->addBCC('bcc@example.com'); // $mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments // $mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name $mail->isHTML(true); // Set email format to HTML $mail->Subject = 'Here is the subject'; $mail->Body = 'This is the HTML message body in bold!'; $mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; if(!$mail->send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; } else { echo 'Message has been sent'; } ?> ivantcholakov commented Sep 24, 2015 Hm, this line is commented: $mail->isSMTP(); // Set mailer to use SMTP PHPMailer member Synchro commented Sep 24, 2015 Please read the docs before posting. Synchro closed
to be processed by a new instance of PHPMailer but this is where problems start to emerge. Namely just one problem, an error https://www.sitepoint.com/community/t/phpmailer-famous-could-not-instantiate-mail-function-error/5807 of "Could not instantiate mail function.". I'm aware this is a very http://docs.mailpoet.com/article/56-could-not-instantiate-mail-function popular problem and the answer is usually SMTP settings (from what I see online) however I'm somewhat confused where to look in the code. I'm testing this offline in the WAMP Apache environment which shouldn't make a difference and I've also downloaded the latest version of PHPMailer (5.1) could not to which my code connects to (PHPMailer is in the folder "PHPMailer" in the root directory of the website files). I would appreciate some pointers where should I be looking to fix this before I go uploading it. Do I just need to pass the SMTP settings in the mail setup below? Since SMTP doesn't authenticate whether the email address could not instantiate I sent from is genuine I should be able to pass it anything such as 123@abc.com right? I don't think it's the port number as then it would say something like "cannot connect to smtp server" as far as I remember back from early 2009 when I had a similar albeit different problem. Here's the code in the page that processes the details ready to send off:
recommend our users to contact their host if this issue persists. If it can't be solved by your host, we usually recommend sending from a professional provider. Based on our experience it can be: you are on a local server (localhost) recipient's email address is invalid there's a special character in the subject there's a special character in the sender/receiver information the subject line is too long the bounce address you specified is not accepted by your server you already sent too many emails 1. You are on a local server (using WAMP for example) This kind of web server does not have a mail server so you can't send emails from your local server. Solution: send with an external SMTP server instead. 2. Your receiver email address is not valid Your mail server may refuse to deliver your message if the receiver email address is not a valid one. If you have " could not instantiate mail function" for only a few of your subscribers, it may just be because their email address is not valid! 3. You included a special character in the subject line Some mail servers will refuse to deliver your message if it contains special characters in the subject such as a quote or a comma or any other kind of special character (ù,ï,ä)... Solution: create a new newsletter, specify a standard subject line ("test" for example) and give it a try. 4. You included a special character in the sender/receiver information The same way, some mail server will refuse to deliver your message if the sender information contain special characters. Solution: remove special chars from a single subscriber to see if that solves the issue. 5. Your subject line is too long Some mail server may not authorize you to deliver your message if the subject line is too long. Solution: shorten your subject line to a single word to make sure it's not a p