Jump to content

Send email from host server


HardCoreMore

Recommended Posts

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 [email protected]. How can i choose to send email from my domain name [email protected]. 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("[email protected]",$subject,"$from<br />$name<br />$message<br />$spam<br />");

echo "Your message has been sent";

} else{

echo "You didn't enter email!";

}

?>

Link to comment
https://forums.phpfreaks.com/topic/95704-send-email-from-host-server/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.