HardCoreMore Posted March 11, 2008 Share Posted March 11, 2008 I am learning php now and i learn how to send email with php. Now, i have my domain name www.mysupercashcow.info that i am using with hosting company turnkeyhostings.com. I made my email account on that hosting control panel that name is hardcore and when i send email the script works fine but when i check out email i see that it has been sent from hardcore@host.turnkeyhostings.com. How can i choose to send email from my domain name hardcore@mysupercashcow.info. This is the script that i am using <?php if (isset($_POST["userEmail"])){ $to = $_POST["userEmail"]; $subject = $_POST["userSubject"]; $message = $_POST["userMessage"]; $from = $_POST["userEmail"]; $spam= $_POST["spam"]; $name = $_POST["userName"]; mail("caslav.sabani@gmail.com",$subject,"$from<br />$name<br />$message<br />$spam<br />"); echo "Your message has been sent"; } else{ echo "You didn't enter email!"; } ?> Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted March 11, 2008 Share Posted March 11, 2008 One second im just getting the code from my server Quote Link to comment Share on other sites More sharing options...
HardCoreMore Posted March 11, 2008 Author Share Posted March 11, 2008 Ok, no problem. Thanks man! Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted March 11, 2008 Share Posted March 11, 2008 Okay heres the code, it also lets you put html into your emails. <? $from= $_POST['userEmail']; $to= $_POST['userEmail']; $headers="MIME-Version:1.0 \r\n"; $headers .= "Content-type: text/html;charset=iso-8859-1 \r\n"; $headers .= 'From: Your Name/Company name here <$from>'; $subject = $_POST['userSubject']; $message = $_POST['userMessage']; mail($to, $subject, $message, $headers); ?> Tried to make it suit your code as much as possible Quote Link to comment Share on other sites More sharing options...
HardCoreMore Posted March 11, 2008 Author Share Posted March 11, 2008 Ok but where do you exactly specify from which email it will send the message. Because with this code it will send it from hardcore@host.turnkeyhostings.com again. Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted March 11, 2008 Share Posted March 11, 2008 Change this line... $headers .= 'From: Your Name/Company name here <$from>'; to... $headers .= 'From: Company name here <hardcode@host.turnkeyhostings.com>'; Make sure you change company name here to your company name or your own name. Quote Link to comment Share on other sites More sharing options...
HardCoreMore Posted March 11, 2008 Author Share Posted March 11, 2008 It still send me emails from hardcore@host.turnkeyhostings.com instead hardcore@mysupercashcow.info Quote Link to comment Share on other sites More sharing options...
HardCoreMore Posted March 12, 2008 Author Share Posted March 12, 2008 I didn't check it right. It works without problem. Thanks again man. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.