/    Sign up×
Community /Pin to ProfileBookmark

problems with email

Hello all,

I have some code below that creates an email from a web form :

[code=php]<?php
// create the email message

$msg .= “Please create this account and credit it with $10 nnn”;

$msg .= “ACCOUNT DETAILS nn”;

if ($nickname != “”) {
$msg .= “Nick Name : $nicknamen”;
}
if ($username != “”) {
$msg .= “User Name : $usernamen”;
}
if ($password != “”) {
$msg .= “Password : $passwordnn”;
}
$msg .= “Personal DETAILS nn”;

if ($from != “”) {
$msg .= “First Name : $fromn”;
}
if ($middlename != “”) {
$msg .= “Middle Name : $middlenamen”;
}
if ($lastname != “”) {
$msg .= “Last Name : $lastnamen”;
}
if ($dateofbirth != “”) {
$msg .= “Date of Birth : $dateofbirthn”;
}
$msg .= “Address : $addressn”;

if ($town != “”) {
$msg .= “Town : $townn”;
}
if ($postcode != “”) {
$msg .= “Postcode : $postcoden”;
}
if ($county != “”) {
$msg .= “County : $countyn”;
}
if ($country != “”) {
$msg .= “Country : $countryn”;
}
if ($telephone != “”) {
$msg .= “Telephone : $telephonen”;
}
if ($email != “”) {
$msg .= “Email : $emailn”;
}

if ($bigslickprivate != “”) {
$msg .= “Join the Big Slick Private Members club? : $bigslickprivaten”;
}
if ($bigslickplayers != “”) {
$msg .= “Join the Big Slick Players Club? : $bigslickplayersn”;
}
if ($bigslickpreffered != “”) {
$msg .= “Obtain membership to Big Slick’s preferred members club? : $bigslickprefferednn”;
}
$msg .= “Sent : $todayn”;

$mailheaders = “Poker account registration ( $username ) n”;

$mailheaders = “From: $email”;

mail($to, $subject, $msg, $mailheaders);[/code]

I am trying to have the users email address (the person who has just filled out the form) appear in the “from” field, but the webserver seems to fill in its own address.

here is how I have the from address set up :

[code=php]$mailheaders = “From: $email”; [/code]

the $email variable is populated from a form field. Any Ideas how to do this?

Thanks

to post a comment
PHP

3 Comments(s)

Copy linkTweet thisAlerts:
@purefanMay 02.2006 — try this:
[code=php]
# SEND THE EMAIL
ini_set(sendmail_from,'[email protected]'); // the INI lines are to force the From Address to be used !
mail($emailaddress, $emailsubject, $msg, $headers);
ini_restore(sendmail_from);
[/code]
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMay 02.2006 — <i>
</i># not $mailheaders
[B]$subject[/B] = "Poker account registration ( $username )";

# for additional extra headers, add [B]rn[/B] at the end of each but the last
$mailheaders = "From: $email";
Copy linkTweet thisAlerts:
@LiLcRaZyFuZzYMay 02.2006 — If you send an e-mail to a person using his/her e-mail address as the sender it might be suspected and treated as spam, you should use some generic e-mail address from your web server (e.g.: [email][email protected][/email] , [email][email protected][/email] , etc..)
×

Success!

Help @fogofogo 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.18,
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,
)...