Subscribe Now: freedictionary

Add to The Free Dictionary

Monday, 12 March 2012

I'd change this script to the following... PHP Code:

I'd change this script to the following...
PHP Code:

<?php 

  $smtp_server "smtpserver.com"; 

  $port 25; 

  $mydomain "mydomain.com"; 

  $username "username";

  $password "password"; 

  $sender "sender email"; 



  if (ISSet($_REQUEST["recipient"]))

  {

    $recipient $_REQUEST["recipient"]; 

  }

  else

  {

    Die("Recipient is a required field...");

  }

  

  if (ISSet($_REQUEST["subject"]))

  {

    $subject $_REQUEST["subject"]; 

  }

  else

  {

    $subject ""; 

  }

  

  if (ISSet($_REQUEST["content"]))

  {

    $content $_REQUEST["content"]; 

  }

  else

  {

    Die("Content is a required field...");

  }

  

  // SMTP connection 



  $handle fsockopen($smtp_server$port); 

  fputs($handle"EHLO " $mydomain "\r\n"); 



  // SMTP authorization 

  fputs($handle"AUTH LOGIN\r\n"); 

  fputs($handlebase64_encode($username)."\r\n"); 

  fputs($handlebase64_encode($password)."\r\n"); 



  // Send out the e-mail 

  fputs($handle"MAIL FROM:<" $sender ">\r\n"); 

  fputs($handle"RCPT TO:<" $recipient ">\r\n"); 

  fputs($handle"DATA\r\n"); 

  fputs($handle"To: " $recipient "\n"); 

  fputs($handle"Subject: " $subject "\n\n"); 

  fputs($handle$content "\r\n"); 

  fputs($handle".\r\n"); 



  // Close connection to SMTP server 

  fputs($handle"QUIT\r\n"); 
?>

The form as per Chris

No comments:

Post a Comment

comment.........

Engineering -Thinks of Words

Subscribe Now: google

Add to Google Reader or Homepage