简单的:
<form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
<input type=submit>
</form>asp:
需要一个发邮件的组件,可以用cdonts
开通SMTP服务设好IP
<%set mailobject=server.createobject("cdonts.newmail")
mailobject.from="[email protected]"
mailobject.to="[email protected]"
mailobject.subject="aaaaaaaaa" '主题
mailobject.body="aaaaaaaaaa" '内容
'mailobject.attachfile "c:\text.txt" "text" '附件 绝对路径 名
mailobject.send
%>PHP:
<?
mail("[email protected]", "没有主题", $message, "From: [email protected]\nReply-To: [email protected]\nX-Mailer: PHP/" . phpversion());
?>
<form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
<input type=submit>
</form>asp:
需要一个发邮件的组件,可以用cdonts
开通SMTP服务设好IP
<%set mailobject=server.createobject("cdonts.newmail")
mailobject.from="[email protected]"
mailobject.to="[email protected]"
mailobject.subject="aaaaaaaaa" '主题
mailobject.body="aaaaaaaaaa" '内容
'mailobject.attachfile "c:\text.txt" "text" '附件 绝对路径 名
mailobject.send
%>PHP:
<?
mail("[email protected]", "没有主题", $message, "From: [email protected]\nReply-To: [email protected]\nX-Mailer: PHP/" . phpversion());
?>
下面这我找的代码,但有所不理解.<html>
<head>
<title>以邮件形式提交表单!</title>
<meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
</head><body bgcolor="#ffffff">
<h2>以邮件形式提交表单!</h2>
<form action="mailto:[email protected]" enctype="multipart/form-data" name="test111" id="test111">
<p>
</p>
<p>您的姓名:
<input type="text" name="yourName" id="textID"/>
</p>
<p> 性 别:
<select name="sex">
<option selected>请选择</option>
<option value="男">男</option>
<option value="女">女</option>
</select>
</p>
<p>所在城市:
<input type="radio" name="city" value="北京" id="radiobuttonID"/>
北京
<input type="radio" name="city" value="上海" id="radiobuttonID"/>
上海
<input type="radio" name="city" value="广州" id="radiobuttonID"/>
广州</p>
<p>爱 好:
<input type="checkbox" name="Favorites" value="运动" id="checkboxID" />
运动
<input type="checkbox" name="Favorites" value="音乐" id="checkboxID" />
音乐
<input type="checkbox" name="Favorites" value="文学" id="checkboxID" />
文学</p>
<p>其它信息:
<textarea name="textfield" id="textID" cols="32" rows="2"></textarea>
</p>
<p></p>
</form>
<form action="mailto:[email protected]" enctype="multipart/form-data" name="mail" id="mail"
onsubmit="getAllText('test111')">
<input name="Subject" type="hidden" value="我的邮件标题" />
<input name="Body" type="hidden" value="这里是邮件的主体!" />
<input type="Submit" name="Submit" value="Submit"/>
</form>
</body>
</html><script>
var subinfo = new Array();
function getAllText(f)
{
el = document.forms[f].elements;
for(var i=0;i<el.length;i++)
{
//遍历select
if(el[i].type=="select-one"||el[i].type=="select-multiple")
{
elname = el[i].name;
for(var j=0;j<el[i].options.length;j++)
{
if(el[i].options[j].selected)
{
subinfo[subinfo.length]=[elname,el[i].options[j].value];
}
}
}
//遍历checkbox
if(el[i].type=="checkbox"&&el[i].checked)
{
elname = el[i].name;
subinfo[subinfo.length]=[elname,el[i].value];
}
//遍历radio
if(el[i].type=="radio"&&el[i].checked)
{
elname = el[i].name;
subinfo[subinfo.length]=[elname,el[i].value];
}
//遍历radio
if(el[i].type=="textarea"||el[i].type=="text")
{
elname = el[i].name;
subinfo[subinfo.length]=[elname,el[i].value];
}
}
document.all.Body.value=subinfo.toString();
}
</script>
<%@language=vbscript%>
<%option explicit%>
<html>
<head>
<title>发邮件</title>
</head>
<body bgcolor=#ffffff>
<%
dim strname,strsubject,strquery,strsender,strfile
strname=trim(request.form("recivename"))
strsubject=trim(request.form("subject"))
strquery=trim(request.form("message"))
strsender=trim(request.form("sender"))
strfile=trim(request.form("file"))
if (strname<>""and strsubject<>"" and strquery<>"" and strsender<>"") then
dim objmail
set objmail=server.createobject("cdonts.newmail")
objmail.from=strsender
objmail.to=strname
objmail.subject=strsubject
objmail.body=strquery
if strfile<>"" then
objmail.attachfile strfile
end if
objmail.send
response.write "successful, thank you!"
set objmail=nothing
else
%>
<h1>发邮件</h1>
<form action="<%=request.servervariables("script_name")%>"
method=post>
<table border=0>
<tr><td>收件人</td><td><input type=text name="recivename"
value="" size=40></td></tr>
<tr><td>主题</td><td><input type=text name="subject"
value="" size=40></td></tr>
<tr><td>邮件</td><td><textarea name="message"
cols=40 rows=10></textarea></td></tr>
<tr><td>发件人</td><td><input type=text name="sender"
value="" size=40></td></tr>
<tr><td>附件</td><td><input type=file name="file"
value="" size=40></td></tr>
</table>
<input type="submit" value="发送">
<input type="reset" value="取消">
</form>
<%end if%>
</body>
</html>
你要确认你是否正确安装开通SMTP服务器,并设置好SMTP中的IP地址.
cdonts组件是系统自带默认安装的.