/    Sign up×
Community /Pin to ProfileBookmark

Error Sending Mail

I am xammp and am try to send mail using PHP .

[code=php]
<?php
$to = ‘[email protected]’;
$subject = ‘the subject’;
$message = ‘hello’;
$headers = ‘From: [email protected]

mail($to, $subject, $message, $headers);
?>
[/code]

But this code never gives any result to us .

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@sneakyimpDec 08.2008 — You should check for an error when you call mail:
[code=php]mail($to, $subject, $message, $headers)
or die('mail failed');[/code]


If you get a 'mail failed' out of that then the problem is that PHP was unable to hand off mail to sendmail (or whatever method it uses to send out mail). If that is the case, then PHP is not really configured properly.

If you don't get the error, then your email might be getting caught in a spam filter somewhere between your PHP server and the destination mail account.

You may find this link helpful:

http://www.phpbuilder.com/board/showthread.php?s=&postid=10781635
×

Success!

Help @arpit_vavadia 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.24,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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