Email sending program based on the mail service software (IMAIL) under NT-(online version)

Source: Internet
Author: User
If you cannot install IMAIL on the server, you can only send emails through socket. However, if you are lucky, you can use 163/sina's
Smtp service.
The routine is as follows (the original program is provided by Ma Yixiong ):
<HTML>
<HEAD>
<TITLE> Mail Form anywhere </TITLE>
</HEAD>
<BODY>
<?
If ($ sendit)
{
$ Smtpserver = "202.110.200.242"; // set this as the imail ip address
Echo "<pre> ";
$ Fp = fsockopen ($ smtpserver, 25, & $ errno, & $ errstr, 10); // connect to the smtp server, port 25
If (! $ Fp) die ("wrong open smtp SERVER ");
$ Hostreplay = fgets ($ fp, 128 );
// If (! Strstr ($ hostreplay, "220") die ("can n' t receive the 220 answer ");
$ Smailname = strstr (ltrim ($ hostreplays), "220 ");
$ Smailname = substr ($ smailname, 0, strpos ($ smailname ,"."));
// Echo "smailname: $ smailname ";
Fputs ($ fp, "$ smailname ");
$ Hostreplay = fgets ($ fp, 128 );
// If (! Strstr ($ hostreplay, "250") die ("can n' t receive the 250 answer ");
Fputs ($ fp, "mail from :");
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250 ")){
Fputs ($ fp, "mail from: root ");
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250 ")){
Fputs ($ fp, "mail from: root@263.net ");
Echo ($ hostreplay = fgets ($ fp, 128 ));
If (! Strstr ($ hostreplay, "250 ")){
Fputs ($ fp, "mail from: $ from_address ");
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250") die ("can n' t receive the 250 answer ");
};
};
};
Fputs ($ fp, "rcpt to: $ to_address ");
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250 ")){
Fputs ($ fp, "rcpt to: $ mailname ");
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250") echo ("can n't receive the 354 answer ");
Related Article

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.