.php doesn't execute on web hosting [duplicate]












1
















This question already has an answer here:




  • PHP mail function doesn't complete sending of e-mail

    25 answers




when I test the php code on MAMP local server it's work and show me "email send"
but on the Directadmin it doesn't show anything!!



the file extension is .php



this is the php code i'm using:



<?php

if($_POST["submit"]) {
$recipient="my-email@hotmail.com";
$subject=" contact";
$sender=$_POST["fullname"];
$senderEmail=$_POST["email"];
$message=$_POST["message"];
$phone=$_POST["phone"];
$Organaization=$_POST["Organaization"];


$mailBody="Name: $sendernEmail: $senderEmailnPhone: $phonenOrganaization: $Organaizationnn$message";



$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= 'From:' . $sendername . '<' . $senderemail . '>' . "rn";
$mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message";
if (mail($recipient, $subject, $mailBody, $headers)) {
echo "email sent";
} else {
echo "could not send email";
}

}

$thankYou="Your message has been sent.";


?>









share|improve this question















marked as duplicate by il_raffa, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 13:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

    – Dirk Scholten
    Nov 20 '18 at 10:09











  • Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

    – RiggsFolly
    Nov 20 '18 at 10:18











  • this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:24













  • @RiggsFolly I tried to use host email, nothing has been changed !

    – Noor Shaker
    Nov 20 '18 at 12:50
















1
















This question already has an answer here:




  • PHP mail function doesn't complete sending of e-mail

    25 answers




when I test the php code on MAMP local server it's work and show me "email send"
but on the Directadmin it doesn't show anything!!



the file extension is .php



this is the php code i'm using:



<?php

if($_POST["submit"]) {
$recipient="my-email@hotmail.com";
$subject=" contact";
$sender=$_POST["fullname"];
$senderEmail=$_POST["email"];
$message=$_POST["message"];
$phone=$_POST["phone"];
$Organaization=$_POST["Organaization"];


$mailBody="Name: $sendernEmail: $senderEmailnPhone: $phonenOrganaization: $Organaizationnn$message";



$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= 'From:' . $sendername . '<' . $senderemail . '>' . "rn";
$mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message";
if (mail($recipient, $subject, $mailBody, $headers)) {
echo "email sent";
} else {
echo "could not send email";
}

}

$thankYou="Your message has been sent.";


?>









share|improve this question















marked as duplicate by il_raffa, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 13:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

    – Dirk Scholten
    Nov 20 '18 at 10:09











  • Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

    – RiggsFolly
    Nov 20 '18 at 10:18











  • this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:24













  • @RiggsFolly I tried to use host email, nothing has been changed !

    – Noor Shaker
    Nov 20 '18 at 12:50














1












1








1









This question already has an answer here:




  • PHP mail function doesn't complete sending of e-mail

    25 answers




when I test the php code on MAMP local server it's work and show me "email send"
but on the Directadmin it doesn't show anything!!



the file extension is .php



this is the php code i'm using:



<?php

if($_POST["submit"]) {
$recipient="my-email@hotmail.com";
$subject=" contact";
$sender=$_POST["fullname"];
$senderEmail=$_POST["email"];
$message=$_POST["message"];
$phone=$_POST["phone"];
$Organaization=$_POST["Organaization"];


$mailBody="Name: $sendernEmail: $senderEmailnPhone: $phonenOrganaization: $Organaizationnn$message";



$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= 'From:' . $sendername . '<' . $senderemail . '>' . "rn";
$mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message";
if (mail($recipient, $subject, $mailBody, $headers)) {
echo "email sent";
} else {
echo "could not send email";
}

}

$thankYou="Your message has been sent.";


?>









share|improve this question

















This question already has an answer here:




  • PHP mail function doesn't complete sending of e-mail

    25 answers




when I test the php code on MAMP local server it's work and show me "email send"
but on the Directadmin it doesn't show anything!!



the file extension is .php



this is the php code i'm using:



<?php

if($_POST["submit"]) {
$recipient="my-email@hotmail.com";
$subject=" contact";
$sender=$_POST["fullname"];
$senderEmail=$_POST["email"];
$message=$_POST["message"];
$phone=$_POST["phone"];
$Organaization=$_POST["Organaization"];


$mailBody="Name: $sendernEmail: $senderEmailnPhone: $phonenOrganaization: $Organaizationnn$message";



$headers = "MIME-Version: 1.0" . "rn";
$headers .= "Content-type:text/html;charset=UTF-8" . "rn";
$headers .= 'From:' . $sendername . '<' . $senderemail . '>' . "rn";
$mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message";
if (mail($recipient, $subject, $mailBody, $headers)) {
echo "email sent";
} else {
echo "could not send email";
}

}

$thankYou="Your message has been sent.";


?>




This question already has an answer here:




  • PHP mail function doesn't complete sending of e-mail

    25 answers








php email directadmin






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 13:54









Funk Forty Niner

1




1










asked Nov 20 '18 at 10:05









Noor ShakerNoor Shaker

42




42




marked as duplicate by il_raffa, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 13:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by il_raffa, Funk Forty Niner php
Users with the  php badge can single-handedly close php questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 20 '18 at 13:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

    – Dirk Scholten
    Nov 20 '18 at 10:09











  • Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

    – RiggsFolly
    Nov 20 '18 at 10:18











  • this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:24













  • @RiggsFolly I tried to use host email, nothing has been changed !

    – Noor Shaker
    Nov 20 '18 at 12:50



















  • If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

    – Dirk Scholten
    Nov 20 '18 at 10:09











  • Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

    – RiggsFolly
    Nov 20 '18 at 10:18











  • this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:24













  • @RiggsFolly I tried to use host email, nothing has been changed !

    – Noor Shaker
    Nov 20 '18 at 12:50

















If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

– Dirk Scholten
Nov 20 '18 at 10:09





If it shows you a white page then the PHP is definitely being executed, otherwise you would just see your code posted as text. Try var_dump on $_POST before your if statement. See what's in it. Maybe that will clear things up.

– Dirk Scholten
Nov 20 '18 at 10:09













Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

– RiggsFolly
Nov 20 '18 at 10:18





Quite likely you server does not allow email to be sent from an account that is not a valid email account that exists on your server. Try sending the email FORM a valid email created in your hosting package

– RiggsFolly
Nov 20 '18 at 10:18













this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

– Noor Shaker
Nov 20 '18 at 10:24







this is what shows to me after var_dump($_POST) ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; var_dump ($_POST); if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

– Noor Shaker
Nov 20 '18 at 10:24















@RiggsFolly I tried to use host email, nothing has been changed !

– Noor Shaker
Nov 20 '18 at 12:50





@RiggsFolly I tried to use host email, nothing has been changed !

– Noor Shaker
Nov 20 '18 at 12:50












1 Answer
1






active

oldest

votes


















-1














It seems that the condition is not valid :



if($_POST["submit"]) {


Check that the form is really sent :



var_dump($_POST["submit"]);


(just at the beginning of the script)






share|improve this answer
























  • I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:29











  • I delete the scripts after the $mailBody, and try it again but it show me empty page.

    – Noor Shaker
    Nov 20 '18 at 12:49


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1














It seems that the condition is not valid :



if($_POST["submit"]) {


Check that the form is really sent :



var_dump($_POST["submit"]);


(just at the beginning of the script)






share|improve this answer
























  • I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:29











  • I delete the scripts after the $mailBody, and try it again but it show me empty page.

    – Noor Shaker
    Nov 20 '18 at 12:49
















-1














It seems that the condition is not valid :



if($_POST["submit"]) {


Check that the form is really sent :



var_dump($_POST["submit"]);


(just at the beginning of the script)






share|improve this answer
























  • I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:29











  • I delete the scripts after the $mailBody, and try it again but it show me empty page.

    – Noor Shaker
    Nov 20 '18 at 12:49














-1












-1








-1







It seems that the condition is not valid :



if($_POST["submit"]) {


Check that the form is really sent :



var_dump($_POST["submit"]);


(just at the beginning of the script)






share|improve this answer













It seems that the condition is not valid :



if($_POST["submit"]) {


Check that the form is really sent :



var_dump($_POST["submit"]);


(just at the beginning of the script)







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 20 '18 at 10:17









SuperTomaSuperToma

174




174













  • I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:29











  • I delete the scripts after the $mailBody, and try it again but it show me empty page.

    – Noor Shaker
    Nov 20 '18 at 12:49



















  • I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

    – Noor Shaker
    Nov 20 '18 at 10:29











  • I delete the scripts after the $mailBody, and try it again but it show me empty page.

    – Noor Shaker
    Nov 20 '18 at 12:49

















I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

– Noor Shaker
Nov 20 '18 at 10:29





I get that ' . "rn"; $mailBody = "FullName: $sendernamenEmailAddress: $senderemailnPhoneNumber:$senderphonenn$message"; if (mail($recipient, $subject, $mailBody, $headers)) { echo "email sent"; } else { echo "could not send email"; } } $thankYou="Your message has been sent."; ?>

– Noor Shaker
Nov 20 '18 at 10:29













I delete the scripts after the $mailBody, and try it again but it show me empty page.

– Noor Shaker
Nov 20 '18 at 12:49





I delete the scripts after the $mailBody, and try it again but it show me empty page.

– Noor Shaker
Nov 20 '18 at 12:49



Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith