Fatal Error Call To Undefined Method Phpmailer - Setfrom
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings call to undefined method phpmailer::getcustomheaders() contact form 7 and policies of this site About Us Learn more about Stack Overflow call to undefined method phpmailer::getcustomheaders() wordpress the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags call to undefined method stdclass::addaddress() 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 other. Join them; it only
Phpmailer Setfrom Not Working
takes a minute: Sign up Strange Fatal error: Call to undefined method PHPMailer::SetFrom() With Codeigniter up vote 1 down vote favorite I am working on a Codeigniter project and added last version from phpmailer, and used this tutorial to create a mailer_model https://phpsblog.wordpress.com/2010/02/14/phpmailer-en-codeigniter/ After I adapted, I used it on another model and works perfect. Now on this one I php fatal error: call to undefined method phpmailer::getcustomheaders() have this annoying error Here is my custom library Here is the model with the issues load->model('Mailer_model'); #Update code for access on patient Client $data = array('Code' => $code); $this->db->where('idpatients', $idpatient); $this->db->update('patients', $data); #Find Patient Email $qry = "SELECT Email FROM patients WHERE idpatients = '$idpatient'"; $result = $this->db->query($qry)->result(); $emailp = $result[0]->Email; $subject = 'Access to Crossover Laboratory'; $message = '
You now can access to our laboratory results with your name and code.
Code: '. $code . '
' . base_url() . '
'; $body2 = "You now can access to our laboratory results with your name and code.\n Code: ". $code . " \n " . base_url() ; $body = ''.$message.'
'; $here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site fatal error: class 'smtp' not found About Us Learn more about Stack Overflow the company Business Learn more
Phpmailer Library.
about hiring developers or posting ads with us Stack Overflow 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 other. Join them; it only takes a minute: Sign up Fatal error: Call http://stackoverflow.com/questions/32324106/strange-fatal-error-call-to-undefined-method-phpmailersetfrom-with-codeigni to undefined method stdClass::AddAddress() in PHP mailer up vote -1 down vote favorite I'm trying to send an e-mail to multiple e-mail address in my database. Here is my current code.I need to have them query my database and send the e-mail to each e-mail address.It is working but email was send to the first e-mail address only, and got an error "Fatal error: Call http://stackoverflow.com/questions/9817181/fatal-error-call-to-undefined-method-stdclassaddaddress-in-php-mailer to undefined method stdClass::AddAddress()".Where am I going wrong here? getRows("SELECT * FROM `emails`"); foreach($elist as $emails){ $frm = 'test@gmail.com'; $sub = 'Weekly Work Report'; ob_start(); include_once('mail_content.php'); $mail_body = ob_get_contents(); ob_end_clean(); $to = $emails['email']; $mailstatus = lm_mail('1', '2', $to, '3', $frm, 'HR', $sub, $mail_body); if ($mailstatus == 'ok') { $response->redirect('index.php?com_route=user_report'); } else { echo $mailstatus; } } ?> function lm_mail($head_mid='',$head_mname='',$to_mid ,$to_mname='',$reply_mid,$reply_mname='',$subject,$body,$attachments='') { include_once 'phpmailer/mail_config.php'; if(SMTP_mail) { // Send SMTP Mails $mail->From =$head_mid ; // From Mail id $mail->FromName = $head_mname; // From Name $mail->AddAddress($to_mid,$to_mname); // To Address $mail->AddReplyTo($reply_mid,$reply_mname); // From Address $mail->Subject=$subject; $mail->Body = $mail_body.$body; //HTML Body $mail->AltBody = "This is the body when user views in plain text format"; //Text Body if(!$mail->Send()) { return $mail->ErrorInfo; } else { return 'ok'; } } else { $mail = new PHPMailer(); // defaults to using php "mail()" $mail->AddReplyTo($reply_mid,$reply_mname); // Sender address $mail->AddReplyTo($reply_mid,$reply_mname); // replay to address $address = $to_mid; // to addtesas $mail->AddAddress($address, $to_mname); $mail->Subject = $subject; $mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test $mail->MsgHTML($mail_body.$body); if(!$mail->Send()) { return $mail->ErrorInfo; } else { return 'ok'; } } } php phpmailer share|improv
going to send it, the following message appears: Fatal error: https://teamtreehouse.com/community/sending-email Call to undefined method PHPMailer::SetForm() The line code corresponding to the line mentioned in the error is this one: $mail->SetFrom($email, $name); Does anyone know why is that a fatal error and how can I fix it? Thanks a lot! 3 Answers dalehudson 6,330 Points dalehudson dalehudson 6,330 Points over 2 call to years ago Hi Ana What version of PHPMailer are you using? try this with the code you have. Or it might be worth trying to replace: $mail->SetFrom($email, $name); With: $mail->From = $email; $mail->FromName = $name; PRO oslo parker Pro Student 1,225 Points oslo parker oslo parker Pro Student 1,225 Points over call to undefined 2 years ago Fatal error: Call to undefined method PHPMailer::Set*Form*() The line code corresponding to the line mentioned in the error is this one: $mail->Set*From*($email, $name); Form != From... Unless im missing something else or the typo is in your post. KnowledgeWoods Consulting 5,607 Points KnowledgeWoods Consulting KnowledgeWoods Consulting 5,607 Points over 2 years ago Please Help...!!! I am able to send mail to .com id's but not on .in id's . Following is my code:
Name | $name |
Phone No. | $contact |
Enquiry | $comment |