Jump to content

Php Mail Problems

Recommended Posts

I am a reseller and don't have great (ok, basically no) php skills -- there, I've started with full disclosue :)


A developer is building a new site for one of my hosting customers and has hit a problem making php mail work -- here is what he tells me:


"I may not have explained it very well. I don't have any smtp or user/pass information and I don't understand ur system very well. It might not be a "technical" issue.


Here is the code I was trying to use. I get the echo but never receive an email."


$to = "someone@domain.com";
$subject = "www.**** - Contact Submission";
$email = "formmail@****" ;
$message = "test message" ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
 	msg = "Your mail was sent successfully";
 	$msg = "We encountered an error sending your mail";




Can anyone give me an idea of what I should tell him -- how to point him in the right direction?




Link to post
Share on other sites

I can see a simple syntax error, you were missing the dollar sign before 'msg' after the if statement


try this code:



      	$to = 'someone@domain.com';
       $subject = 'www.**** - Contact Submission';
       $email = 'formmail@****';
       $message = 'test message';
       $headers = 'From: $email';
      	if(mail($to, $subject, $message, $headers)
            	$msg = 'Your mail was sent successfully';
               $msg = 'We encountered an error sending your mail';

       echo $msg;


I haven't taken a chance to properly check this code but on the face of it it seems ok.

Edited by OJB
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...