I choose SMTP, but get mail() error

#1
[eluser]nunomira[/eluser]
Hi,

I have a config file for sending email, something like:
Code:
$config['protocol'] = 'smtp';

$config['smtp_host'] = 'mail.myDomain.com';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'myDomain';


$config['email_from'] = '[email protected]';
$config['email_from_name'] = 'sender';

The thing is that I'm getting this error:

Quote:RROR - 2009-02-16 23:05:12 --&gt; Severity: Warning --&gt; mail() [<a href='function.mail'>function.mail</a>]: Failed to connect to mailserver at &quot;localhost&quot; port 25, verify your &quot;SMTP&quot; and &quot;smtp_port&quot; setting in php.ini or use ini_set() C:\wamp\www\myDomain-productions\CodeIgniter_1.7.1\system\libraries\Email.php 1519
ERROR - 2009-02-16 23:05:12 --&gt; Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.<br /><pre>From: "Tribal Productions" <[email protected]>
Return-Path: <[email protected]>
Reply-To: "[email protected]" <[email protected]>
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)

How is this?
I choose SMTP, have everything configured and CI tries to use mail() !
And this was working at work. But not now, at home (different computer).

I have a slight idea that I've had this problem in the past... and that it related to having AVG installed... but I'm not realy sure.
Can AVG block CI's SMTP connection and CI defaults to mail() ?
Does this make sense?

#2
[eluser]Kyle Short[/eluser]
Not a lot of info to go on...do you have an SMTP server running on localhost? What do your email config settings look like?

#3
[eluser]brianw1975[/eluser]
was just working on a server that used smtp just the other day.

if your mail server is on the same machine try changing mail.myDomain.com to localhost or 127.0.0.1

fixed their junk up real quick.

your sys-admin you should contact for the answer you seek, young padawan. mmm yes.

sorry, had to for some reason....

ps my client had a windows server

#4
[eluser]nunomira[/eluser]
Hi,

The SMTP server is not local, it's on a server on the web.
It's a real domain. Not exactly myDomain.com, but something like that.

The config settings are exactly the ones above, although these ones are dummy data).

#5
[eluser]Kyle Short[/eluser]
Hmm, your error states that it is trying to connect to an SMTP on local host. Do you have your config settings in an email.cfg file (not normal config file)? You may want to set a port too...possibly 587

#6
[eluser]nunomira[/eluser]
Hi,

Yes, the config file is just fine.
I'm sure of this, because I've used it in the past, and exactly the same site which I'm working on, was working fine when I was at work. Now I'm at home. Different computer... same code... and not working.

#7
[eluser]Pinguis[/eluser]
Hi, i had the same problem and solved it by adding this line

Code:
ini_set('SMTP', 'your.smtp.server');

Its likely a CI bug, i suppose?

#8
[eluser]bikuta[/eluser]
[quote author="Pinguis" date="1239070609"]Hi, i had the same problem and solved it by adding this line

Code:
ini_set('SMTP', 'your.smtp.server');

Its likely a CI bug, i suppose?[/quote]

Where did you add the line exactly?

#9
[eluser]Pinguis[/eluser]
[quote author="bikuta" date="1257096065"]

Where did you add the line exactly?[/quote]

Put it somewhere near the mail function call.
For instance, at the beginning of the controller that uses it, where you would place code to load helpers, libraries, etc.

#10
[eluser]novice32[/eluser]
I have the same problem:

I used to be able to send emails, but now I get the following:
Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() Filename: libraries/Email.php. Yet I have
Code:
$config['email']['smtp_host'] = 'smtp.comcast.net';
in my email.php and also commented out in my php.ini the SMTP section and restarted the server (no values were really set). Emails now work ONLY if I use
Code:
ini_set('SMTP', 'smtp.comcast.net');


I'm developing on XAMPP.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.