SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Self Duplicated Email Script No Longer Works

    Hi,

    I have the following email processing script which works perfectly on one website I have. However I have tried to copy it onto another site and it no longer works. I have included the insert page, it is only the email term I am looking to send but whatever I try it work sending anything.

    Could there be a setting on my server which could allow one site to work but stop one script from working?



    Code:
    <?php
    
    $EmailFrom = ".com - Contact Us";
    $EmailTo = "email@yahoo.com";
    $Subject = ".com Contact Form";
    $Name = Trim(stripslashes($_POST['Name'])); 
    $Tel = Trim(stripslashes($_POST['Tel'])); 
    $Email = Trim(stripslashes($_POST['Email'])); 
    $Message = Trim(stripslashes($_POST['Message'])); 
    
    // validation
    $validationOK=true;
    if (!$validationOK) {
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
      exit;
    }
    
    // prepare email body text
    $Body = "";
    $Body .= "Name: ";
    $Body .= $Name;
    $Body .= "\n";
    $Body .= "Tel: ";
    $Body .= $Tel;
    $Body .= "\n";
    $Body .= "Email: ";
    $Body .= $Email;
    $Body .= "\n";
    $Body .= "Message: ";
    $Body .= $Message;
    $Body .= "\n";
    
    // send email 
    $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
    
    // redirect to success page 
    if ($success){
      print "<meta http-equiv=\"refresh\" content=\"0;URL=contactthanks.php\">";
    }
    else{
      print "<meta http-equiv=\"refresh\" content=\"0;URL=error.htm\">";
    }
    ?>





    Code:
    <div class="articleemailsignup">
    	
    
    
    <div id="contact-area">
    		
    			<form  name="loginForm"  method="post" action="/siteinfo/contactengine.php">
    				<ul >
    				
    				
    				<div id="contactareabox">
    				<div id="contactareatitle">Newsletter Signup:</div>
    					<div id="contactareacell">
    				<input type="text" name="Email" id="Email" /></text>
    				    </div>
    				</div>
    				
    		
    					</div>
    									 
    			  	<div class="contactusbutton">
                 
    							<div class="user-area">
     <input type="submit" value="Submit" class="submit-button" /> 
    		</div>	   
    		   	</div>	
    	
    		</ul>
            </form>  
    			
    </div>

  2. #2
    SitePoint Evangelist captainccs's Avatar
    Join Date
    Mar 2004
    Location
    Caracas, Venezuela
    Posts
    516
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by justlukeyou View Post
    Could there be a setting on my server which could allow one site to work but stop one script from working?
    Yes. For example the new server might not have an mail server or the mail() function might not be implemented. If the host of the new server has a help desk, you might ask them about email.
    Denny Schlesinger
    web services

  3. #3
    SitePoint Addict bronze trophy vectorialpx's Avatar
    Join Date
    Dec 2012
    Location
    Bucharest
    Posts
    247
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php
    // ...
    $success = @mail($EmailTo$Subject$Body"From: <$EmailFrom>");
    check what do you get from a
    PHP Code:
    var_dump($success); 
    in case the result is false, you may also check
    PHP Code:
    $weHaveMail function_exists('mail');
    var_dump($weHaveMail); 
    Be nice to nerds. Chances are you'll end up working for one - Bill Gates
    > photos | admin panel

  4. #4
    SitePoint Wizard
    Join Date
    Apr 2002
    Posts
    2,318
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Is this the actual line?:

    $EmailFrom = ".com - Contact Us";

    If it is, try a proper email address. (Plus, I have no idea if this'll make any difference, just a suggestion: ) try the domain name being the same as the server you're sending from.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •