Jump to content

SMTP setup. I know this has been answered a thousand times but....


28rain

Recommended Posts

The book i am using to learn is full of funny random errors whicj i need help fixing. OK this is my ini config for the smtp:

[mail function]

; For Win32 only.

SMTP = smtp.googlemail.com

smtp_port = 25

 

; For Win32 only.

;sendmail_from = william.kelsey@gmail.com

 

and i am using localhost 127.0.0.1 to test my scripting, yet i get this error:

 

 

Warning: mail() [function.mail]: Failed to connect to mailserver at "smtp.googlemail.com" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\send_simpleform.php on line 16

 

and the firewall is turned off.

Link to comment
Share on other sites

Sounds like you need to contact Google to get the right address and port.  I don't think they allow mail on port 25, pretty sure they use authentication on a port like 295 or 995.  Either way, check their site since this has nothing to do with PHP.

Link to comment
Share on other sites

Yeah thanks guys the only change which helped me really was taking the semi colon out i had thought that there might be a change in port but thanks for telling me to use the tls one not the other one!.

Now i get this error do you need to see my script to see the problem??

530 5.7.0 Must issue a STARTTLS command first. i6sm3420993gve.26

 

Its on line 16 where i have:

mail($to, $subject, $msg, $mailheaders);

 

Thanks a mill guys

Link to comment
Share on other sites

Read the "Outgoing Mail (SMTP) Server" information at this link to find out which port you need to use - "http://mail.google.com/support/bin/answer.py?hl=en&answer=13287

 

Yes, post your current code, it could be doing any number of things right and wrong.

 

Edit: And since you are still using the php mail() function, you won't be able to get this to work until you switch to use one of the php mailer classes that will allow you to use SMTP authentication.

 

 

Link to comment
Share on other sites

OK heres my script but i tell you there are no errors... P.s the html one is fine but if you really want to see that aswell. Please can you tell me how to intergrate this with php mailer because i have downloaded/copied the php mailer files but what next!!

 

<?

if (($_POST['sender_name'] == " ") ||

    ($_POST['sender_email'] == " ") ||

    ($_POST['message'] == " ")) {

header ("location: simple_form.html");

exit;

}

$msg = "E-MAIL SENT FROM WWW SITE\n";

$msg .= "Sender's name:\t$_POST[sender_name]\n";

$msg .= "Senders's E-mail:\t$_POST[sender_email]\n";

$msg .= "Message:\t$_POST[message]\n;";

$to = "william.kelsey@gmail.com";

$subject = "Web Site Feedback";

$mailheaders = "From: My Web Site <genericaddress@yourdomain.com>\n";

$mailheaders .= "Reply-To: $_POST[sender_email]\n";

mail($to, $subject, $msg, $mailheaders);

?>

<html>

<head>

<title>Simple Feedback Form Sent</title>

</head>

<body>

<H1>The following e-mail has been sent:</H1>

<P>Your Name: <br>

<? echo "$_POST[sender_name]"; ?>

<P> Your email address is: <br>

<? echo "$_POST[sender_email]"; ?>

<p> Message: <br>

<? echo "$_POST[message]"; ?>

</body>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.