Welcome Guest, Not a member yet? Register   Sign In
Email Sending, but nothing in inbox
#1

[eluser]srpurdy[/eluser]
Hi All,

I'm having a strange problem. I'm trying to set up a simple contact form. Everything says the email is being sent, yet I get nothing in multiple different emails I've tried. Even in the spam box is empty.

Quote:Your message has been successfully sent using the following protocol: mail

From: "Shawn"
Return-Path:
Reply-To: "blocked out"
X-Sender: blocked out
X-Mailer: Code Igniter
X-Priority: 3 (Normal)
Message-ID: <blockedout>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
test14
test14

My controller file is below
Code:
&lt;?php

class contact extends MY_Controller {

function contact()
{
parent::MY_Controller();    
$this->load->helper('url');
$this->load->helper('form');
$this->load->library('email');
}

function index()
    {        
    $content = $this->load->view('contact', '', true);
    $sidebar = $this->load->view('sidebar', '', true);
    $navigation = $this->load->view('navigation', '', true);

    $this->wrapOutput($content, $sidebar, $navigation);    
    }
    function send(){
    //Email Post data
    $this->email->from($_POST['from'], $_POST['name']);
    $this->email->to('[email protected]');

    $this->email->subject($_POST['subject']);
    $this->email->message($_POST['tel']);
    $this->email->message($_POST['message']);

    //Sending the email
    $this->email->send();
    
    //View
    $content = $this->load->view('sent', '', true);
    $sidebar = $this->load->view('sidebar', '', true);
    $navigation = $this->load->view('navigation', '', true);
    $this->wrapOutput($content, $sidebar, $navigation);
    echo $this->email->print_debugger();
}
}
?&gt;

Is their anything im doing wrong that could cause this?
Thanks,
Shawn
#2

[eluser]Tom Glover[/eluser]
I'm not quite sure what is wrong but this code i have just written works perfectly.

Controller File
Code:
function send(){
    
        $this->load->helper(array('form'));
            
        $rules['name']        = "required|encode_php_tags|xxs_clean";
        $rules['email']        = "required|valid_email";
        $rules['tel']        = "required|numeric";
        $rules['subject']    = "required|encode_php_tags|xxs_clean";
        $rules['message']    = "required|encode_php_tags|xxs_clean";
        
        $this->validation->set_rules($rules);
        
        
        if ($this->validation->run() == FALSE)
        {
            $form['state']        = "1";
            $data['content'] = $this->load->view('contact',$form,true);
            $data['pageTitle'] = 'Contact us';
            $data['introText'] = "Below are way in how to contact us at ****";
            $this->load->view('template',$data);
        }
        else
        {
            $form['state']        = "2";
            $data['content'] = $this->load->view('contact',$form,true);
            $data['pageTitle'] = 'Contact us';
            $data['introText'] = "Below are way in how to contact us at ****";
            $this->load->view('template',$data);
            
            //Write and Send Email//
            $this->load->library('email');
            /*$config['smtp_host'] = '****';
            $config['smtp_user'] = '****';
            $config['smtp_pass'] = '*****';*/
            $config['protocol'] = 'sendmail';
            $config['useragent'] = 'WebSite - *****';
            $config['mailtype'] = 'html';
            
            $this->email->initialize($config);
            
            $this->email->from('*****@****.***', '****');
            $this->email->reply_to($_POST['email'], $_POST['name']);
            $this->email->to('*****@****.***');
            if ($_POST['copyEmail'] == 1){
                $this->email->cc($_POST['email']);
                $message['clientCopy'] = 'Email copied to client.';
            }
            $this->email->subject($_POST['subject'].' - Web-Site Form');
            //construct the messsage//
                $message['name']        = $_POST['name'];
                $message['tel']        = $_POST['tel'];
                $message['email']       = $_POST['email'];
                $message['subject']    = $_POST['subject'];
                $message['message']    = $_POST['message'];
                $message['clientCopy'] = 'Email copied to client.';
            //output message as var//
                $this->email->message($this->load->view('email',$message,true));
            
            // Send email
            $this->email->send();
            
            //Uncoment Below for Debugger//
             //echo $this->email->print_debugger();
        }
  }

The View File sent via email.
Code:
&lt;body&gt;
<div id="content">
<h1>Web Form Inquiry</h1>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20%" valign="middle"><div align="right"><strong>Full Name: </strong></div></td>
<td width="335" valign="middle">&lt;?php echo $name?&gt;</td>
</tr>
<tr>
<td valign="middle"><div align="right"><strong>Email:</strong></div></td>
<td valign="middle">&lt;?php echo $email?&gt;</td>
</tr>
<tr>
<td valign="middle"><div align="right"><strong>Telephone:</strong></div></td>
<td valign="middle">&lt;?php echo $tel?&gt;</td>
</tr>
<tr>
<td valign="middle"><div align="right"><strong>Subject:</strong></div></td>
<td valign="middle">&lt;?php echo $subject?&gt;</td>
</tr>
<tr>
<td height="60" valign="middle"><div align="right"><strong>Message:</strong></div></td>
<td width="80%" valign="middle">&lt;?php echo $message?&gt;</td>
</tr>
<tr>
<td colspan="2" valign="middle">&lt;?php echo $clientCopy ?&gt;</td>
</tr>
</table>
<p>&nbsp;</p></div>
&lt;/body&gt;

Hope this Helps you fix your problem.
#3

[eluser]elvix[/eluser]
check the email config file to see if the settings for the mail program specified are correct.

CI can use sendmail, smtp, etc. (check user guide). I use my ISP's SMTP gateway for testing on my laptop, which works fine.
#4

[eluser]srpurdy[/eluser]
Thanks Guys,

Unfortually that isn't working for me above either. It says its sent... same thing. However the below seems to work great.

Code:
function send(){
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$email = $_REQUEST['email'];
$name = $_REQUEST['name'];
$headers = 'From: ';
$headers .= $email;
$fn = $name;
$subject = $_REQUEST['subject'];
$message = $_REQUEST['text'];
$mess = $message;
$mess .= "\r\n";
$mess .= $name;
mail('blocked-out', $subject, $mess, $headers);
    //View
    $content = $this->load->view('sent', '', true);
    $sidebar = $this->load->view('sidebar', '', true);
    $navigation = $this->load->view('navigation', '', true);
    $this->wrapOutput($content, $sidebar, $navigation);
}
#5

[eluser]Derek Allard[/eluser]
If you're getting the sent successfully message, then that means that CI has composed, constructed and handed off the email to the mailserver successfully, and the mail server said "ok". At this point, you should probably ask your host if there's anything further that you need to do.
#6

[eluser]srpurdy[/eluser]
[quote author="Derek Allard" date="1206915054"]If you're getting the sent successfully message, then that means that CI has composed, constructed and handed off the email to the mailserver successfully, and the mail server said "ok". At this point, you should probably ask your host if there's anything further that you need to do.[/quote]

Thanks Derek, I figured as much. Unfortually im just hosting under a friends account on a sub-domain, mostly just testing CI at the moment, so I don't have any support lol. Appreciate the responses guys. Smile
#7

[eluser]FuzzyJared[/eluser]
I am having the same issue. I have tried using the default mail, and sendmail methods. I am working with my host to try and figure it out... although I have a feeling that my issue is a little bit more server related than anything. I can't even get it to send a hand coded mail() message.

---

Fixed: Qmail was not turned on for my server.




Theme © iAndrew 2016 - Forum software by © MyBB