 |
 |
Cannot get PHP mail function to work
|
 |
|
 |
|
Senior User
Join Date: Aug 2002
Location: Pittsburgh, PA, USA
Status:
Offline
|
|
Ok guys, I'm pretty much at a loss on this one. I'm new to PHP and have been able to make some progress so far but have had issues with the mail function. I want an automatically generated email sent when a user registers with the site. For some reason, the email is not being sent.
the function itself was copied from a how-to:
Code:
if(!$insertit){
echo 'There has been an error creating your account. Please contact the webmaster.';
} else {
//acquire user id
$getuserid="SELECT MAX(userid) FROM test";
$queryid=odbc_exec($odbc,$getuserid);
$userid=odbc_result($queryid,1);
// Let's mail the user!
$subject = "Your Membership at MyWebsite!";
$message = "Dear $first_name $last_name,
Thank you for registering at our website, http://www.mydomain.com!
You are two steps away from logging in and accessing our exclusive members area.
To activate your membership, please click here: http://www.mydomain.com/activate.php?id=$userid&code=$db_password
Once you activate your memebership, you will be able to login with the following information:
Username: $username
Password: $random_password
Thanks!
The Webmaster
This is an automated response, please do not reply!";
mail($email, $subject, $message, "From: MyDomain Webmaster<admin@mydomain.com>\nX-Mailer: PHP/" . phpversion());
echo 'Your membership information has been mailed to your email address! Please check it and follow the directions!';
}
I then modifed the php.ini file in the system32 directory (running on win 2000 server). They are running Exchange 2000 as the mail server.
Heres the php.ini:
Code:
[Syslog]
; Whether or not to define the various syslog variables (e.g. $LOG_PID,
; $LOG_CRON, etc.). Turning it off is a good idea performance-wise. In
; runtime, you can define these variables by calling define_syslog_variables().
define_syslog_variables = Off
[mail function]
; For Win32 only.
SMTP = vsexch2.cup.edu
; For Win32 only.
sendmail_from = bil3784@cup.edu
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
The smtp server is correct. I don't have a mail server running here so I can't really test. Anything unusual here? Is the php.ini file supposed to be in the system32 directory? I just want to make sure I have php configured correctly. PHP itself is working but the mail function isn't. Any other way to test or any alternative methods to generate these autoresponses? It has to work with Exchange. Any input appreciated.
-josh
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Feb 2003
Location: Norway
Status:
Offline
|
|
Originally posted by passmaster16:
The smtp server is correct. I don't have a mail server running here so I can't really test. Anything unusual here? Is the php.ini file supposed to be in the system32 directory? I just want to make sure I have php configured correctly. PHP itself is working but the mail function isn't. Any other way to test or any alternative methods to generate these autoresponses? It has to work with Exchange. Any input appreciated.
Not sure where the php.ini file is supposed to be on win32, but you can try the phpinfo() function, which should tell you the correct location.
Does the server run Apache or IIS? At least with Apache there should be something in the errorlog-file which might explain whats wrong.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |