PDA

View Full Version : mail function


Ryltar
12-22-2004, 10:00 PM
Hi, ok I get how to use the mail function, but everytime I try to use it I get this:

Warning: mail(): Failed to connect to mailserver at "'smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\web\APEX Platform Web Site\platform\feedback.php on line 74

line 74 is the if (!mail... line

I use this for the mail sending

ini_set ( sendmail_from, "bob@gmail.com" );
ini_set( SMTP, "'smtp.gmail.com" );
ini_set( smtp_port, 465 );

$to = "bob@hworld.com"; // Mail notification to this address
$subject = "New Feedback";
$message = "";
$message .= "This message has been automatically generated by " . $_SERVER['PHP_SELF'] . "\n";
$message .= "\n";
$message .= "There is a new feedback entry on the APEX Platform Website.\n";
$message .= "Go to feedback_results.php to read it.\n";
$message .= "If you have forgotten the password, please email $admin at $admin_email.\n";
$headers = "From: $admin_email\r\n";

if (!mail($to, $subject, $message, $headers)) echo "Error. Could not notify recipient of new feedback. Response may be delayed.<br />\n";



So I know that gmail won't work. I tried with localhost as well and that won't work. So what I am wondering, is there a way for me to set up a mail server on my PC or does someone know of a mailserver that would work for my purposes

--------
PS
This is running off of an Apache server on my PC.

fci
12-22-2004, 10:07 PM
you can setup Mercury Mail (I set it up a long time ago when I used Windows, I can't remember how I got it working though but I was able to send emails from the localhost)
http://www.pmail.com/downloads_maine_t.htm

Horus Kol
12-23-2004, 08:42 AM
that's odd.. smtp is normally on port 25...

fci
12-23-2004, 11:04 AM
that's odd.. smtp is normally on port 25...

http://gmail.google.com/support/bin/answer.py?answer=13276&rand=0.07981982780446595
# Enter '465' in the 'Outgoing mail (SMTP):' field.

gmail requires an SSL connection so that may be a contributing factor.. and it requires authentication.

Horus Kol
12-23-2004, 11:51 AM
ah - the authentication is what's messing the PHP mail then...

Ryltar
12-23-2004, 12:59 PM
ahh ok. Well I will try mercury mail thanks!

Horus Kol
12-23-2004, 01:31 PM
your web-host will most likely have an SMTP server - and it should be configured in their php.ini already...