The joys of PHP mail()
-
<?php
$to = "someone@domain.com";
$subject = "Test";
$message = "Hello";
$from = "someonelse@domain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...
-
<?php
$to = "someone@domain.com";
$subject = "Test";
$message = "Hello";
$from = "someonelse@domain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...
I have a similar setup and I don't see anything wrong with what you have, so unless I'm blind it looks like it should indeed work. In fact what you have is almost identical to the php documentation. Are you sure the server email system is working and has the correct settings in the php.ini file?
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
I have a similar setup and I don't see anything wrong with what you have, so unless I'm blind it looks like it should indeed work. In fact what you have is almost identical to the php documentation. Are you sure the server email system is working and has the correct settings in the php.ini file?
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?
I'm not an expert in PHP mail, but I think the mail server needs to be set in the php.ini file if using Windows. If Linux, then you'll have to do something different to use a remote SMTP server. Here are a couple of links that might help: http://email.about.com/od/emailprogrammingtips/qt/Configure_PHP_to_Use_a_Remote_SMTP_Server_for_Sending_Mail.htm[^] http://email.about.com/gi/o.htm?zi=1/XJ&zTi=1&sdn=email&cdn=compute&tm=112&f=10&tt=13&bt=1&bts=1&zu=http%3A//pear.php.net/package/Mail[^] Take a look at PEAR, too.
CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
<?php
$to = "someone@domain.com";
$subject = "Test";
$message = "Hello";
$from = "someonelse@domain.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>as far as i understand this is a valid mail function, but on the server it won't send anything to anyone, even my hotmail account .....What am i doing wrong ? this is all the code i have for this particular function so that i can test if it will work to submit feedback results to another mailbox.... (obviously the mail $to email is the one i am only using for this forum post ) i have asked the server support team and they say that this should work? any ideas what else to try ...
class SafeEmail 30 { 31 function create($user, $host, $suffix) 32 { 33 $at = "@"; 34 $dot = "."; 35 36 $start = $user . at . $host; 37 $end = $dot . $suffix; 38 $address = $start . end 39 40 return $address; 41 } 42 43 $se = new SafeEmail(); 44 $se->create($user, $host, $suffix); 45 }
More php email scripts listed on the page! -
turns out the server people lied to me, thanks for your help anyway .... any idea what i could do to get an SMTP? could i send the information to another website easily or ?