Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts

    Question php email not sending?!

    can someone please help with my PHP emailer?
    the form submits and I get to thankyou.htm page after submission but I do not receive an email?!
    Code:
    <?php
     $title = tidyInput($_POST['title']) ;
       $first_name = tidyInput($_POST['first_name']) ;
      $last_name =tidyInput( $_POST['last_name'] );
      $company = tidyInput($_POST['company'] );
      $job = tidyInput($_POST['job'] );
      $email =tidyInput( $_POST['email']) ; 
      $tel = tidyInput($_POST['tel']) ;
      $enquiry = tidyInput($_POST['enquiry']) ;
        $domain = tidyInput($_POST['domain']) ;
    	  $trademark = tidyInput($_POST['trademark']) ;
    	    $channel = tidyInput($_POST['channel']) ;
    		  $phishing = tidyInput($_POST['phishing']) ;
      
      $message = "Name: ".$title." ".$first_name." ".$last_name."\n";
       $message .= "Firma: ".$company."\n";
      $message .= "Stellenbezeichnung: ".$job."\n";
      $message .= "Email: ".$email."\n";
      $message .= "Telefon: ".$tel."\n";
      $message .= "Informationen: ".$enquiry."\n";
      $message .= "Interessieren Domain Management: ".$domain."\n";
        $message .= "Online Channel Protection: ".$channel."\n";
    	  $message .= "Online Trademark Protection: ".$trademark."\n";
    	    $message .= "AntiPhishing Solutions : ".$phishing."\n";
    		 $message .= "Informieren : ".$consent."\n";
      
      
      function tidyInput($text){
        $cleanOutput = strtolower($text);
        $cleanOutput = str_replace('\n', "", $cleanOutput);
        $cleanOutput = str_replace(array('\r', '\n', '%0a', '%0d', 'content-type:', 'subject:', 'bcc:', 'to:', 'cc:', '\\'), "", $cleanOutput);
        $cleanOutput = strip_tags($cleanOutput);
        $cleanOutput = stripslashes($cleanOutput);
        return $cleanOutput;
    }
    
    
      mail( "email@blah.com", "Mark Monitor Form",    $message, "From: $email" );
     header( "Location: thankyou.htm" );
    ?>
    Last edited by jarv; 03-10-2009 at 04:48 PM.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Add this to the top of your code
    PHP Code:
    ini_set('display_errors','1');
    error_reporting(E_ALL); 
    Then change this
    PHP Code:
    mail"blah@domain.com""Mark Monitor Form",    $message"From: $email" ); 
    to this
    PHP Code:
    $headers  "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers .= "From: $first_name $last_name<$email>\r\n" .
                
    "Reply-To: ".$email.""
    mail"blah@domain.com""Mark Monitor Form"$message$headers); 
    I also suggest you remove your email addresses from this thread to help prevent spam.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • Users who have thanked _Aerospace_Eng_ for this post:

    jarv (03-10-2009)

  • #3
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    Thanks, done that, now I get:


    Notice: Undefined index: domain in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 13

    Notice: Undefined index: trademark in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 14

    Notice: Undefined index: channel in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 15

    Notice: Undefined index: phishing in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 16

    Notice: Undefined variable: consent in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 28

    Warning: mail() [function.mail]: SMTP server response: 501 Syntax error in parameters or arguments in D:\home\Default\marken-schutzonline.de\htdocs\sendmail.php on line 48

    I was just looking into the mail(); function on my IIS server

    this is what is in my php.ini file:

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    ; For Win32 only.
    ;sendmail_from = me@example.com

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    ;sendmail_path =

    ; Force the addition of the specified parameters to be passed as extra parameters
    ; to the sendmail binary. These parameters will always replace the value of
    ; the 5th parameter to mail(), even in safe mode.
    ;mail.force_extra_parameters =

  • #4
    Banned
    Join Date
    Mar 2007
    Posts
    1,523
    Thanks
    116
    Thanked 0 Times in 0 Posts
    all sorted now, just needed to activate the sendmail_from:

    ; For Win32 only.
    ;sendmail_from = me@example.com


  •  

    Posting Permissions

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