Welcome Guest, Not a member yet? Register   Sign In
email->send() returns incorectly
#1

[eluser]Dan Bowling[/eluser]
I'm getting a bad return on my send() function of the email helper.
Code:
$alumni = $this->alumni_model->get_alumni_in_region_by_city($region, $city);
                
                    foreach ($alumni as $alumnus)
                    {
                        $this->email->clear();
                        
                        $this->email->from($this->session->userdata('user_email'), $this->session->userdata('user_name'));
                        $this->email->to($alumnus->alumni_email);
                        $this->email->subject($subject);
                        $this->email->message($message);    
                        echo "<li>$alumnus->alumni_email ($alumnus->alumni_city)...";
                        if($this->email->send()){
                            echo "<span class='good'>SENT</span></li>";
                        }else{
                            echo "<span class='bad'>FAILED</span></li>";
                        }
                    }

When that evaluates, the page outputs failed, even though I get the email.

I'm using XAMPP with a remote SMTP gateway.

Any ideas?
#2

[eluser]Derek Allard[/eluser]
can you work through the email lib to figure out where its dying?
#3

[eluser]Derek Jones[/eluser]
Also what is output by $this->email->print_debugger()?
#4

[eluser]thinkigniter[/eluser]
I had a similar problem on our Intranet and this is how I got it to work.

First I used the sendmail replacement from glob.com.au.

placing the sendmail.exe in C:/wamp/bin/sendmail

And configured the sendmail.ini

Then I set this in my php.

Code:
$config_mail['protocol'] = 'sendmail';
$config_mail['mailpath'] = 'C:/wamp/bin/sendmail/sendmail -t';
$config_mail['smtp_port'] = '25';
$this->email->initialize($config_mail);

And made sure port 25 was open on the Intranet Server

And it worked like a charm.
I was very surprised it wasn't harder!
#5

[eluser]Dan Bowling[/eluser]
I've enabled email debugging, and I get the following message: Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.

Here's the full details:

Code:
220 xxx.xxx.xxx ESMTP Sendmail Switch-3.3.1/Switch-3.3.1; Wed, 10 Sep 2008 12:33:18 -0600 (MDT)
hello: 250-cug2.umt.edu Hello mymachine.gs.umt.edu [xx.x.xxx.xxx], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 31457280
250-DSN
250-ETRN
250-DELIVERBY
250 HELP
from: 250 2.1.0 ... Sender ok
to: 250 2.1.5 ... Recipient ok
data: 354 Please start mail input.

The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Wed, 10 Sep 2008 12:33:18 -0600
From: "Dan Bowling"
Return-Path:
To: [email protected]
Subject: s
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0


Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

sad

I'll try to go through the library and determine what specifically is causing it later tonight.

I'm using an external SMTP server, so I shouldn't have to set up sendmail locally, right? Otherwise my email wouldn't be going out at all (which it is.) I've verified that my php.ini settings are correct (and since I'm using XAMPP, I've checked to make sure it is right in the php and apache folder, since it might be using either one.)
#6

[eluser]Derek Jones[/eluser]
Are you on Windows, dbowling? IIRC, you'll have to manually set the sendmail_from address in your php.ini for SMTP in that environment for a valid Return-Path Sender address.




Theme © iAndrew 2016 - Forum software by © MyBB