fanar
asked on
PHP mail problems
I am developing a website and I have it setup so whenever you register for a new account it sends an email for activation. However when I try to use the mail function I get an error.
I am currently running wamp.
This is the error i get:
Warning: 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() in C:\home\home_install\wamp\ www\Books\ register.p hp on line 64
my php.ini section for the mail function.
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = null
my php code:
$to = $regemail;
$subjust = "activation";
$message = "test message";
mail($to,$subject,$message );
I am currently running wamp.
This is the error i get:
Warning: 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() in C:\home\home_install\wamp\
my php.ini section for the mail function.
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = null
my php code:
$to = $regemail;
$subjust = "activation";
$message = "test message";
mail($to,$subject,$message
change localhost to the address of your ISPs Outgoing Mail Server or yours if you have one.
PHP has no mail system built in it just calls a standard mail server.
PHP has no mail system built in it just calls a standard mail server.
RWJDCom, you can also set the SMTP server with just vanilla PHP, in php.ini (like the settings the asker quoted) or with ini_set().
Yes, asecnt, but if your SMTP server requires authentaction you can't set that information in the php.ini. Thats why I recommended phpmailer.
-Jeff
-Jeff
PEAR::Mail's docs indicate that it supports authentication.
Yes but there is a chance the users server WONT have SMTP authentication if he doesent know what it is then the chances are hes using his ISPs which is liklely to be Open Relay anyway.
Why bother going into setting up PHPMailer when the issue can be resolved quite simply by adding a line to the php.ini. If the user then requires authentication they can look at adapting their code.
Why bother going into setting up PHPMailer when the issue can be resolved quite simply by adding a line to the php.ini. If the user then requires authentication they can look at adapting their code.
ASKER
how do i find what my ISPs is?
Another question then: once i am done developing it I am moving the website to an actual webhost, do most of them support mail with php?
Another question then: once i am done developing it I am moving the website to an actual webhost, do most of them support mail with php?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Check the documentation of phpmailer on how to do this and if you are still having problems please let me know and I will let you know the exact syntax of what I use.
I hope this helps.
-Jeff