NT Mail delivery program based on mail Service software (IMAIL)--(online version) _php

Source: Internet
Author: User
Keywords send program web version mail based software Fp hostrep
IMail

If you are unable to install IMAIL on the server, you can only send mail through the socket. But if you're lucky, you can also use 163/sina.

SMTP Service.

The routines are as follows (the original program was provided by Ma):


<title>Mail Form Anywhere</title>


if ($sendit)
{
$smtpserver = "202.110.200.242"; Set this to the IP of IMail
echo "
" ;
$fp = Fsockopen ($smtpserver, & $errno, & $errstr, 10); Connecting to an SMTP server, port 25
if (! $fp) die ("Wrong open SMTP SERVER");
$hostreplay =fgets ($FP, 128);
if ($hostreplay, "!strstr") Die ("Can n ' t receive the answer");
$smailname =strstr (LTrim ($hostreplay), "220");
$smailname =substr ($smailname, 0,strpos ($smailname, "."));
echo "\nsmailname: $smailname \ n";
Fputs ($fp, "$smailname \ n");
$hostreplay =fgets ($FP, 128);
if ($hostreplay, "!strstr") Die ("Can n ' t receive the answer");

Fputs ($fp, "MAIL from: \ n");
$hostreplay =fgets ($FP, 128);
if (!strstr ($hostreplay, "250")) {
Fputs ($fp, "MAIL from:root\n");
$hostreplay =fgets ($FP, 128);
if (!strstr ($hostreplay, "250")) {
Fputs ($fp, "MAIL from:root@263.net\n");
Echo ($hostreplay =fgets ($FP, 128));
if (!strstr ($hostreplay, "250")) {
Fputs ($fp, "MAIL from: $from _address\n");
$hostreplay =fgets ($FP, 128);
if ($hostreplay, "!strstr") Die ("Can n ' t receive the answer");
};
};
};
Fputs ($fp, "RCPT to: $to _address\n");
$hostreplay =fgets ($FP, 128);
if (!strstr ($hostreplay, "250")) {
Fputs ($fp, "RCPT to: $mailname \ n");
$hostreplay =fgets ($FP, 128);
if (!strstr ($hostreplay, ")") echo ("Can n ' t receive the 354 answer");
};
Fputs ($fp, "data\n");
$hostreplay =fgets ($FP, 128);
if (!strstr ($hostreplay, "354")) Die ("Can n ' t receive the answer");
$tosend = "From: $from _address\n";
$tosend. = "To: $to _address\n";
$tosend. = "Subject:". Str_replace ("\ n", "", $subject). " \ n Hello, this is Yukuang sent you a test letter!!

\n.\n ";
Fputs ($fp, $tosend);
$hostreplay =fgets ($FP, 128);
if ($hostreplay, "!strstr") Die ("Can n ' t receive the answer");
Fputs ($fp, "quit\n");
Fclose ($FP);
echo "Send Success";
Exit ();
if ($ck _name!= ' root ') die ("
Bye Bye ");

};

?>







The program in the LAN debugging through, my IP is 202.110.200.242, for everyone to test
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.