Welcome Guest, Not a member yet? Register   Sign In
Sending mail by SMTP
#1

[eluser]Garden-variety Fool[/eluser]
Hello, CodeIgniter Community!

Although I've been using the ExpressionEngine forums for quite some time, I believe this is my first post on the CodeIgniter side.

I'm writing today because I've started using OpenGateway (a CodeIgniter app) on a few of my client sites, and on one of them I've been having trouble getting it to send e-mail notifications the way it should. By default, OpenGateway uses the defaul "mail" protocol listed on the page at the URL below, but on one particular host I am required to use SMTP instead.

http://ellislab.com/codeigniter/user-gui...email.html

In attempting to follow the instructions for the e-mail library above, I modified the /path/to/system/opengateway/config/email.php file so that it looks like this:

Code:
$config['protocol'] = 'smtp';
$config['wordwrap'] = TRUE;
$config['validate'] = TRUE;
$config['smtp_host'] = 'my.smtp.host';
$config['smtp_user'] = 'my_account_name';
$config['smtp_pass'] = 'my_password';
$config['smtp_port'] = '25';
$config['smtp_timeout'] = '10';

Unfortunately, mail is still not being sent when it should be, so I'm turning to the community here in the hope that someone can help. Is there somewhere else where I need to make changes? Have I done something wrong in the config options above?

Any advice would be greatly appreciated. Thank you!
#2

[eluser]prince1001[/eluser]
For sending mail, I only use this below
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['smtp_port'] = 25;

Hope it works for you also.
#3

[eluser]Garden-variety Fool[/eluser]
[quote author="prince1001" date="1290372960"]For sending mail, I only use this below
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['smtp_port'] = 25;

Hope it works for you also.[/quote]

Thanks for the response, prince1001!

Unfortunately, I cannot use "localhost" on this particular host; the outbound messages must be sent through a specific SMTP server designated for that purpose.
#4

[eluser]Garden-variety Fool[/eluser]
I should maybe also note that the same host name, account name, and password work without problems in the e-mail configuration I have set up in ExpressionEngine on the same host, so I'm pretty sure it is not a problem with the mail account or with the login credentials, etc.
#5

[eluser]prince1001[/eluser]
you're welcome Garden-variety Fool. I thought it wouldn't be as simple as 'localhost' but it was worth the try. Have you tried to capture an error message (show_error($this->email->print_debugger())Wink?
If so what was it?
#6

[eluser]Garden-variety Fool[/eluser]
[quote author="prince1001" date="1290374090"]you're welcome Garden-variety Fool. I thought it wouldn't be as simple as 'localhost' but it was worth the try. Have you tried to capture an error message (show_error($this->email->print_debugger())Wink?
If so what was it?[/quote]

Thanks again, prince1001!

No, I haven't tried that yet, but it seems like it would be worth a try. Where would I put that, in the config/email.php file? Where would I look for the output?
#7

[eluser]mihaibaboi[/eluser]
[quote author="Garden-variety Fool" date="1290399908"]
No, I haven't tried that yet, but it seems like it would be worth a try. Where would I put that, in the config/email.php file? Where would I look for the output?[/quote]

You could try this:
Code:
if($this->email->send())
{
    echo "Email sent";
}
else
{
    show_error($this->email->print_debugger());
}

And the errors will be output to the screen in you view.




Theme © iAndrew 2016 - Forum software by © MyBB