Note that there are some explanatory texts on larger screens.

plurals
  1. POCodeIgniter send email
    text
    copied!<p>I have some problems, meaning that I don't receive mail from a form...</p> <p>the code looks like this: </p> <pre><code>public function send_email(){ $this-&gt;load-&gt;library("form_validation"); $this-&gt;form_validation-&gt;set_rules("fullName", "Full Name", "required|alpha|xss_clean"); $this-&gt;form_validation-&gt;set_rules("email", "Email Address", "required|valid_email|xss_clean"); $this-&gt;form_validation-&gt;set_rules("message", "Message", "required|xss_clean"); if($this-&gt;form_validation-&gt;run() == FALSE){ $data["message"] = ""; $this-&gt;load-&gt;view("site_header"); $this-&gt;load-&gt;view("site_nav"); $this-&gt;load-&gt;view("content_comment", $data); $this-&gt;load-&gt;view("site_footer"); }else{ $data["message"] = "The email was successfully been sent!"; $this-&gt;load-&gt;library("email"); $this-&gt;email-&gt;from(set_value("email"), set_value("fullName")); $this-&gt;email-&gt;to("paulharbuz@gmail.com"); $this-&gt;email-&gt;subject("Message from our form"); $this-&gt;email-&gt;message(set_value("message")); $this-&gt;email-&gt;send(); echo $this-&gt;email-&gt;print_debugger(); $this-&gt;load-&gt;view("site_header"); $this-&gt;load-&gt;view("site_nav"); $this-&gt;load-&gt;view("content_comment", $data); $this-&gt;load-&gt;view("site_footer"); } } </code></pre> <p>And i get an error that looks like this:</p> <blockquote> <p>Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.** </p> </blockquote> <p>Is this from my php.ini file? </p> <p>i've set my files reading this part on <a href="http://php.net/manual/en/ref.mail.php" rel="nofollow noreferrer">http://php.net/manual/en/ref.mail.php</a></p> <p>i found the solution: create a file in config: email.php that looks like this</p> <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /* | ------------------------------------------------------------------- | EMAIL CONFING | ------------------------------------------------------------------- | Configuration of outgoing mail server. | */ $config['wordwrap'] = FALSE; $config['mailtype'] = 'html'; $config['crlf'] = '\r\n'; $config['charset']='utf-8'; $config['newline']="\r\n"; $config['priority']=1; $config['protocol']='smtp'; $config['smtp_host']='ssl://smtp.googlemail.com'; $config['smtp_port']='465'; $config['smtp_timeout']='30'; $config['smtp_user']='gcc.sandbox@gmail.com'; $config['smtp_pass']='qwaszx12'; $config['newline']="\r\n"; /* End of file email.php */ /* Location: ./system/application/config/email.php */ </code></pre> <p>then load this in your main controller like: <code>$this-&gt;email-&gt;initialize($this-&gt;config-&gt;config);</code> and that's it! </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload