/    Sign up×
Community /Pin to ProfileBookmark

mail() function

How to use mail() to send email to free account email/any email for hotmail, yahoo email account etc?

Here my code

[code=php]
<?php
// Your email address
$email = “[email protected]”;

// The subject
$subject = “Enter your subject here”;

// The message
$message = “Enter your message here”;

mail($email, $subject, $message, “From: $email”);

echo “The email has been sent.”;
?>
[/code]

When sent, got error message “Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for [email][email protected][/email] in C:xampphtdocsexamplemail.php on line 11″.

How to solve that problem so that the mail() actually can sent mail?

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@NogDogMar 14.2009 — Your mail server is probably configured to require that the From address be a valid email address on that server (in order to prevent spammers from using it as a relayer). You therefore should try setting the "From:" header to a valid email account on your web host, then add a "Reply-To:" header for the user-supplied response email address.
Copy linkTweet thisAlerts:
@wterauthorMar 14.2009 — I want use the IIS there got 1 domains that can be use to send email. But i wonder is it need to configure anything? Or need setting configuration php.ini file?

Thanks
Copy linkTweet thisAlerts:
@StevishMar 14.2009 — It's possible that the problem is the fact that the script is on your home computer, which may not be capable of sending the E-mails via php.
×

Success!

Help @wter 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.3,
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,
)...