×

Loading...
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!
Ad by
  • 技多不压身,工到自然成:安省技工证书特训班,点击咨询报名!

1 2 3 4 answers

本文发表在 rolia.net 枫下论坛1. common answer is CGI(perl)
code sample:
open(MAIL, "|/usr/lib/sendmail -oi -t") or die "can't fork sendmail: $!";
print MAIL <<EOF;
From: $0 (your cgi script)
To: hisname\@hishost.com
Subject: mailed form submission

EOF
save_parameters(*MAIL);
close(MAIL)


2. PHP. use PHP SMTP code
Solution
Use PEAR's Mail class:

require 'Mail.php';

$to = 'adam@example.com';

$headers['From'] = 'webmaster@example.com';
$headers['Subject'] = 'New Version of PHP Released!';

$body = 'Go to http://www.php.net and download it today!';

$message =& Mail::factory('mail');
$message->send($to, $headers, $body);
If you can't use PEAR's Mail class, use PHP's built-in mail( ) function:

$to = 'adam@example.com';
$subject = 'New Version of PHP Released!';
$body = 'Go to http://www.php.net and download it today!';

mail($to, $subject, $body);



3. ASP on Windoze NT/2K
If you're using ASP in WinNT or Win2K Server, you have CDONTS component
installed by default (unless you customized your Windows installation.
You could send mail by using CDONTS.NewMail object like this:

<%
set o_mailer = Server.CreateObject("CDONTS.NewMail")
o_mailer.From = "me@mydomain.com"
o_mailer.To = "you@yourdomain.com"
o_mailer.Subject = "Test"
o_mailer.Body = "Hello, how are you" &vbCrLf& "I'm testing send mail
function of CDONTS"
o_mailer.Send
set o_mailer = nothing
%>

You could also use other component like ASPMail to do this. Consult the
component manual on how to do that.

4. .NET solution
Use system.web.mail
http://www.aspnetpro.com/features/2002/09/asp200209kg_f/asp200209kg_f.asp

OK?更多精彩文章及讨论,请光临枫下论坛 rolia.net
Report

Replies, comments and Discussions:

  • 工作学习 / IT技术讨论 / 请教, <form action="mailto:my_email_address@yahoo.com" method="post">能否把用户输入的数据送到我的EMAIL里?书上是这么说的可我试了一下按"SUBMIT"总弹出outlook express发送EMAIL的窗口,郁闷 :(
    • 在客户端,也就这样了。
      • 什么意思呢?有什么办法把用户输入的信息发到我的EMAIL吗?
    • 1 2 3 4 answers
      本文发表在 rolia.net 枫下论坛1. common answer is CGI(perl)
      code sample:
      open(MAIL, "|/usr/lib/sendmail -oi -t") or die "can't fork sendmail: $!";
      print MAIL <<EOF;
      From: $0 (your cgi script)
      To: hisname\@hishost.com
      Subject: mailed form submission

      EOF
      save_parameters(*MAIL);
      close(MAIL)


      2. PHP. use PHP SMTP code
      Solution
      Use PEAR's Mail class:

      require 'Mail.php';

      $to = 'adam@example.com';

      $headers['From'] = 'webmaster@example.com';
      $headers['Subject'] = 'New Version of PHP Released!';

      $body = 'Go to http://www.php.net and download it today!';

      $message =& Mail::factory('mail');
      $message->send($to, $headers, $body);
      If you can't use PEAR's Mail class, use PHP's built-in mail( ) function:

      $to = 'adam@example.com';
      $subject = 'New Version of PHP Released!';
      $body = 'Go to http://www.php.net and download it today!';

      mail($to, $subject, $body);



      3. ASP on Windoze NT/2K
      If you're using ASP in WinNT or Win2K Server, you have CDONTS component
      installed by default (unless you customized your Windows installation.
      You could send mail by using CDONTS.NewMail object like this:

      <%
      set o_mailer = Server.CreateObject("CDONTS.NewMail")
      o_mailer.From = "me@mydomain.com"
      o_mailer.To = "you@yourdomain.com"
      o_mailer.Subject = "Test"
      o_mailer.Body = "Hello, how are you" &vbCrLf& "I'm testing send mail
      function of CDONTS"
      o_mailer.Send
      set o_mailer = nothing
      %>

      You could also use other component like ASPMail to do this. Consult the
      component manual on how to do that.

      4. .NET solution
      Use system.web.mail
      http://www.aspnetpro.com/features/2002/09/asp200209kg_f/asp200209kg_f.asp

      OK?更多精彩文章及讨论,请光临枫下论坛 rolia.net
      • 谢谢!!!!您老可懂得真多呀~~~~~~~~我准备试一试你的CGI方案