If you cannot install IMAIL on the server, you can only send emails through socket. However, if you are lucky, you can also use the smtp service of 163sina. The routine is as follows (the original program is provided by Ma Yi brother): HTMLHEADTITLEMailFormanywhereTITLEHEADBODY? If ($ sendit) {$ smtpserver202.110.200.242; set this to IMail
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 ):
Mail Form anywhere
If ($ sendit)
{
$ Smtpserver = "202.110.200.242"; // set this as the imail ip address
Echo"
";
$ 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 "\ nsmailname: $ smailname \ n ";
Fputs ($ fp, "$ smailname \ n ");
$ Hostreplay = fgets ($ fp, 128 );
// If (! Strstr ($ hostreplay, "250") die ("can n' t receive the 250 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 (! Strstr ($ hostreplay, "250") die ("can n' t receive the 250 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, "250") 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 250 answer ");
$ Tosend = "From: $ from_address \ n ";
$ Tosend. = "To: $ to_address \ n ";
$ Tosend. = "Subject:". str_replace ("\ N", "", $ subject). "\ n Hello, this is a test letter from yukuang !!
\ N. \ n ";
Fputs ($ fp, $ tosend );
$ Hostreplay = fgets ($ fp, 128 );
If (! Strstr ($ hostreplay, "250") die ("can n' t receive the 250 answer ");
Fputs ($ fp, "QUIT \ n ");
Fclose ($ fp );
Echo "sent successfully ";
Exit ();
// If ($ ck_name! = 'Root') die ("
Bye ");
};
?>
The program passes debugging in the LAN. my IP address is 202.110.200.242 for testing.