Can't get mail function to work on Windows / IIS
Moderator: General Moderators
Can't get mail function to work on Windows / IIS
I'm trying to send an email to a user who has just logged in. I've tried the mail() function, and set the values in my php.ini file to my ISP's smtp server, but it just doesn't want to work. I've even tried the PEAR Mail function where you can tell it to use PHP's mail, SMTP or whatever, but also doesn't work.
All that happens is that the mail() function returns FALSE everytime.
Please can someone advise me on this.?
Windows XP, IIS 5.1, PHP 4.3.6.
All that happens is that the mail() function returns FALSE everytime.
Please can someone advise me on this.?
Windows XP, IIS 5.1, PHP 4.3.6.
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
// 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 ... b_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!";
if (@mail($email_address, $subject, $message . phpversion())){
echo ("Your membership information has been mailed to your email address! Please check it and follow the directions!");
} else {
echo ("Not working!");
}
I use this code, but all is get back is the text in the else part... Not working!....
$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 ... b_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!";
if (@mail($email_address, $subject, $message . phpversion())){
echo ("Your membership information has been mailed to your email address! Please check it and follow the directions!");
} else {
echo ("Not working!");
}
I use this code, but all is get back is the text in the else part... Not working!....
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact:
You've got no from / reply-to address, most SMTP servers I've ever used will freak out at this and reject the mail.
Try something far more simple just to see if it works:
Try something far more simple just to see if it works:
Code: Select all
mail('someone@domain.com', 'Subject', 'Hello', 'From: your@real_email.com');Still does the same thing. my php.ini settings are like this...
[mail function]
; For Win32 only.
SMTP = smtp.mighty.co.za
; For Win32 only.
sendmail_from = zooter@mighty.co.za
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
[mail function]
; For Win32 only.
SMTP = smtp.mighty.co.za
; For Win32 only.
sendmail_from = zooter@mighty.co.za
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
- launchcode
- Forum Contributor
- Posts: 401
- Joined: Tue May 11, 2004 7:32 pm
- Location: UK
- Contact: