Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 220, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in temp.php on line 53
Warning: Cannot modify header information - headers already sent by (output started at temp.php:53) in temp.php on line 55
51: if(xxxxxxx)
52: {
53: mail($to,$sub,$mesNamePass);
54: $domain="xxx.com";
55: header('Location:'. $domain);
56: }programming newbie :)

Hi,
Do you have a mail server installed on localhost? If not you should configure your mail settings in PHP.ini to 'point' to your mail server.
It should look something like:
SMTP = smtp.xxxxx.xxx
smtp_port = 25sendmail_from = xxxx@xxxxx.xxx
Once the mail server is properly configured, you may want to silence the 'mail' function and handle errors (sort of), by using something like:
if (@mail(...)) {
header('Location:'. $domain);
}
else {
echo "Something went wrong, please try again in a few minutes or contact support at: ..."
}Hth,
Elinor
Elinor Hurst
http://elinorhurst.blogspot.com

the above error was rectified...now its not showing me any error but the mail is not getting passed but goes to next stage of ma program ie. geting routed to another page.
below are php.ini editions done by me
SMTP = smtp.attwireless.net
smtp_port = 25sendmail_from = sample@sample.com
if any more procedures i have to follow ?
programming newbie :)

Hi,
Is if (mail(...)) returning true?
I expect the server requires authentication in order to relay. If that is the case, you may want to investigate the following article, which explains how to do this using the PEAR mail package: http://email.about.com/od/emailprog...
Hth,
Elinor
Elinor Hurst
http://elinorhurst.blogspot.com

hey that really helped
im using mime::mail package
all procedures are done but yet i cant pass the mail to inbox.
the code dosent even show any error but mail is not geting passed
programming newbie :)

here is my code
test
<?php
ini_set ("display_errors", 1);
$your_html_message = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Hello World!</title>
</head>
<body>
Hello World!</p>
</body>
</html>' .
'.';
require_once ("Mail.php");
require_once ("Mail/mime.php");
$recipients = 'User <sen.newjob@gmail.com>';
$headers["From"] = 'User <sen.newjob@gmail.com>';
$headers["To"] = 'User <sen.newjob@gmail.com>';
$headers["Subject"] = "Ready To Eat Pears";
$crlf = "\n";
$mime = new Mail_mime($crlf);$mime->setHTMLBody($your_html_message);
$message = $mime->get();
$headers = $mime->headers($headers);
$params["host"] = 'smtp.gmail.com';
$params["auth"] = TRUE;
$params["auth"] = PLAIN;
$params["username"] = 'sen.newjob@gmail.com';
$params["password"] = 'xxxx';
$params["localhost"]= 'smtp.gmail.com';
$params["debug"] = "True";
Mail::factory method
$mail_message =& Mail::factory('smtp', $params);
$mail_message->send ($recipients, $headers, $message);
?>if i execute this i get something like this in my browser
test DEBUG: Recv: 220 mx.google.com ESMTP w12sm339947tib.10 DEBUG: Send: EHLO smtp.gmail.com DEBUG: Recv: 250-mx.google.com at your service, [122.164.170.210] DEBUG: Recv: 250-SIZE 35651584 DEBUG: Recv: 250-8BITMIME DEBUG: Recv: 250-STARTTLS DEBUG: Recv: 250 ENHANCEDSTATUSCODES DEBUG: Send: RSET DEBUG: Recv: 250 2.1.5 Flushed w12sm339947tib.10 DEBUG: Send: QUIT DEBUG: Recv: 221 2.0.0 closing connection w12sm339947tib.10
but my mail not geting reached to my inbox :(
plz help meprogramming newbie :)

Hi again,
Mmm... Not sure.
This:
$params["auth"] = TRUE;
$params["auth"] = PLAIN;
looks a little weird though.Shouldn't that simply be:
$params["auth"] = true;
?I would also suggest trying to use only the email address in $to, $from, etc. as I have found the 'long' notation can cause problems on some systems.
Another thought: have you tried sending something really simple like : subject 'Ready to eat pears' and message 'Ready to eat pears' ?
hth,
Elinor
Elinor Hurst
http://elinorhurst.blogspot.com

hi brother,
thanks for burning ur valuable time in guiding me
the scenario is :
i am trying to send a mail via a remote smtp server from a webserver(localhost) using wamp people say this is not possible because the smtp servers will not accept connections from outside port 80(http) to their port 25(smtp) to avoid abusing..
is this true ???
and regarding sending a simple mail...if some message like "i like to eat pears" gets apssed then the html also shld do ryt ?nothing gets away :(
i did the changes u said no effect..
i use this because to put md5-sum when needed$params["auth"] = PLAIN;
neways now i commented that too..
programming newbie :)

Hi,
Not sure I like being called 'brother', perhaps not being a man has something to do with that... ;-)
Yes obviously most SMTP servers are closed to relaying otherwise get abused by spammers, and so on and so forth.
Your best bet would be to use a mail server that your hosting solution hopefully provides for you. In that case they should give you the relevant information so that you can send from your hosted site through their mail server.
Hth,
Elinor
Elinor Hurst
http://elinorhurst.blogspot.com

oh...
sorry about calling you brother Elinor..its just i address everybody like that...sory if that discomforted you...
and i identified the problem dude...it was abt the smtp i used....gmail required connection through ssl whereas i didnt....changed smtp and it worked...
thanks for your time again :)
programming newbie :)

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |