/    Sign up×
Community /Pin to ProfileBookmark

call to mail() doesn’t work in Windows

Hello people

I am using the following code to try to send an email:

[code=php]
$to = “[email protected]”;
$subject = “This is a test”;
$message = “This is the message body”;
$header = “From: John Smith <[email protected]>”;
mail($to, $subject, $message, $header);
[/code]

This code works fine when I run it on a Linux machine.
It does not work when I try it on a Windows machine

I have SMTP server installed

Is there something wrong in the mail format? including the body and the headers for Windows?

any help would be appreciated

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyDec 19.2005 — is php configured to pick up your mail server running locally?
Copy linkTweet thisAlerts:
@jasongrauthorDec 20.2005 — I was able to get it to work by modifying the header to
[code=php]
$header = "From: [email protected]";

[/code]

Appearantly there is a problem with the first and last name and the usage of <>
×

Success!

Help @jasongr 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.19,
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,
)...