Subscribe Now: freedictionary

Add to The Free Dictionary

Monday, 12 March 2012

controll the smtp protocol

please read this first and after maybe you can "light me" :



<?php
$smtp_server = "smtpserver.com";
$port = 25;
$mydomain = "mydomain.com";
$username = "username"; $password = "password";
$sender = "sender email";
$recipient = "email that the content will be sent to";
$subject = "the subject";
$content = "the message";

// SMTP connection

$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO $mydomain\r\n");

// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
fputs($handle, base64_encode($username)."\r\n");
fputs($handle, base64_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");
?>



No comments:

Post a Comment

comment.........

Engineering -Thinks of Words

Subscribe Now: google

Add to Google Reader or Homepage