/    Sign up×
Community /Pin to ProfileBookmark

XAMPP localhost email sending

Here are my configuration files.

sendmail.ini

[sendmail] ; you must change mail.mydomain.com to your smtp server, ;
or to IIS’s “pickup” directory. (generally C:InetpubmailrootPickup) ;
emails delivered via IIS’s pickup directory cause sendmail to ;
run quicker, but you won’t get error messages back to the calling ; application.

smtp_server=(Correct SMTP Server) ;
smtp port (normally 25)

smtp_port=25

php.ini

[mail function] ;
For Win32 only. ;
[url]http://php.net/smtp[/url] SMTP = (Correct SMTP Server) ;
[url]http://php.net/smtp-port[/url] smtp_port = 25 ;
For Win32 only. ;
[url]http://php.net/sendmail-from[/url]
sendmail_from = (user@(server.com)) <- correct name

PHP code

<?php $
from_name = “testing”;
$from_email = “[email protected]“;
$headers = “From: $from_name <$from_email>”;
$headers = “MIME-Version: 1.0” . “rn”;
$headers .= “Content-type: text/html; charset=iso-8859-1” . “rn”;
$body = “Hi,nThis is a test mail from $from_name <$from_email>.”;
$subject = “Test mail from test”;
$to = “[email protected]“;

if (mail($to, $subject, $body, $headers))
{
echo “success!”;
}
else
{ echo “fail…”; }
?>

When i ran the code, it said “successful” but when I checked the email, there is nothing to received… please help urgently!

Thank you i will provide as many relevant information as possible to solve this issue.

I have been trying to solve this for many days already but it does not show. SMTP port is not blocked by ISP. I used my own personal hotmail address to send to the company’s email and it worked.

Vice versa, i used my company’s email to send “test” to my personal hotmail address. This shows that the company does not block out-bound traffic, what could be the problem now?

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@mtrickApr 12.2012 — <?php if(!empty($_POST['email']))

{

$message =

'<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<body>

<table><tr>

<td><strong>name</strong></td>

<td>'.$_
POST["name"].'</td>

</tr>

<tr>

<td><strong>phone</strong></td>

<td>'.$_POST["phone"].'</td>

</tr>

<tr>

<td><strong>msg</strong></td>

<td>'.$_
POST["msg"].'</td>

</tr>

<tr>

<td><strong>email</strong></td>

<td>'.$_POST["email"].'</td>

</tr>

</table>

</body>

</html>';

$headers = 'MIME-Version: 1.0'."rn";

$headers .= 'Content-type: text/html; charset=iso-8859-1'."rn";

$headers .= 'From: mail.@xyz.com';

$to = '[email protected]'."rn";

$sub = 'Query from website';

mail($to, $sub, $message, $headers);

header("Location:thank-you.php");

}

?>
Copy linkTweet thisAlerts:
@mtrickApr 12.2012 — <?php if(!empty($_POST['email']))

{

$message =

'<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

</head>

<body>

<table><tr>

<td><strong>name</strong></td>

<td>'.$_
POST["name"].'</td>

</tr>

<tr>

<td><strong>phone</strong></td>

<td>'.$_POST["phone"].'</td>

</tr>

<tr>

<td><strong>msg</strong></td>

<td>'.$_
POST["msg"].'</td>

</tr>

<tr>

<td><strong>email</strong></td>

<td>'.$_POST["email"].'</td>

</tr>

</table>

</body>

</html>';

$headers = 'MIME-Version: 1.0'."rn";

$headers .= 'Content-type: text/html; charset=iso-8859-1'."rn";

$headers .= 'From: [email][email protected][/email]';

$to = '[email protected]'."rn";

$sub = 'Query from website';

mail($to, $sub, $message, $headers);

header("Location:thank-you.php");

}

?>
Copy linkTweet thisAlerts:
@PHPNewbie1234authorApr 12.2012 — Sir, i do not understand.

Can you tell me the errors i made?
Copy linkTweet thisAlerts:
@DasherApr 15.2012 — You have to configure a SMTP server on your apache system. A web server is not a mail server. XAMPP comes with mail server software, Mercury Mail Transport System. You need to configure that to work with the php code and php.ini which you have not done.
×

Success!

Help @PHPNewbie1234 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...