Welcome Guest, Not a member yet? Register   Sign In
email error in tutorial setup *RESOLVED*
#1

[eluser]NielsG[/eluser]
Hello,

I followed the userguide form creation (http://ellislab.com/codeigniter/user-gui...ation.html) and in the success page I would like the information to be emailed to me. somehow, when I use a simple script with mail($to, $subject, $message) in a file on its own (mail.php), it works fine, but when I paste the mail function into the formsuccess page, it gives me an error. As though CI does something to the email settings?
The error I get is:
Code:
A PHP Error was encountered

Severity: Warning

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: views/formsuccess.php

Line Number: 25

Any insight into what CI might be doing ?
#2

[eluser]Thorpe Obazee[/eluser]
have you correctly set-up your smtp settings?
#3

[eluser]Dam1an[/eluser]
Not that it would be the cause of the problem, but you shouldn't be sending the email from within the view, it should take place in the controller
#4

[eluser]NielsG[/eluser]
bargainph:
I am not in the position to change smtp settings, but since the script runs perfectly without the CI code around it, I assume that all is well. The host is pretty well known in Holland, so I take it no weird thing there.

Dam1an:
thanks for the advice, but this is supposed to be a very quick and dirty temporary site with a very simple email form.
Any suggestion though to why it's not sending?
#5

[eluser]jedd[/eluser]
[quote author="Nilz" date="1244735071"]The host is pretty well known in Holland, so I take it no weird thing there.[/quote]

Earlier you posted your error message:
Quote:
Code:
Failed to connect to mailserver at "localhost" port 25,

Happily, localhost is well known in every country.

Unless you have an SMTP server on your localhost, this will fail.

You need to really tell the client to talk to whatever SMTP server you believe you currently are.
#6

[eluser]NielsG[/eluser]
Thanks. I understand.
No clue what the address is for the smtp server though. I thought that was configured in the PHP setup?

What I don't get, is that the mail function works properly on its own like mail.php:
Code:
<?php
mail($to, $subject, $message)
?>

I don't need to set a server.

but that same line in a CI view won't work.
do I need to set that server in some CI config then?
#7

[eluser]TheFuzzy0ne[/eluser]
You'll usually be issued with the appropriate information when you sign up for your Web hosting account. A lot of hosts automatically attach it to your domain name, so you'd have smtp.yourdomain.tld as your server address.
#8

[eluser]NielsG[/eluser]
It's fixed.
nothing wrong with script or CI (of course)
the host had an error in the dns. so the baseurl had to be set using the IP address, instead of the domain name.
grrrr.

thx for the help though
#9

[eluser]Miguel Diaz[/eluser]
Nilz a favor I am having the same issue how do you set the ip instead of the domain or where.

Please can you help me I am using a controller that all the time work but now I have a client that instead of running on localhost is running on an ip. Can you help me please
#10

[eluser]NielsG[/eluser]
Hi Miguel

I was refering to the base_url in the applicaion/config/config.php file.
instead of using a domain name I used the ip adres instead. that seemed to work for me.

hope it does for you too.

Niels




Theme © iAndrew 2016 - Forum software by © MyBB