看看那错了这只是一个发邮件的程序

wansijei 2003-09-12 01:32:08
Private Enum SMTP_State
MAIL_CONNECT
MAIL_HELO
MAIL_FROM
MAIL_RCPTTO
MAIL_DATA
MAIL_DOT
MAIL_QUIT
End Enum
Private m_State As SMTP_State
Private First As String
Private Second As String
Private DateNow As Date
Private Third As Date
Private Fourth As String
Private Fifth As String
Private Sixth As String
Private Seventh As String
Private Ninth As String
Private Eighth As String
Private Sub Command1_Click() '发送按钮
Winsock1.Close
Winsock1.LocalPort = 0
Winsock1.Protocol = sckTCPProtocol
Winsock1.RemoteHost = "smtp.sohu.com"
Winsock1.RemotePort = 25
Winsock1.Connect
m_State = MAIL_CONNECT
End Sub

Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)
Dim strServerResponse As String
Dim strResponseCode As String
Dim strDataToSend As String
Winsock1.GetData strServerResponse
Debug.Print strServerResponse
strResponseCode = Left(strServerResponse, 3)
If strResponseCode = "250" Or strResponseCode = "220" Or strResponseCode = "354" Then
Select Case m_State
Case 0
m_State = MAIL_HELO
Winsock1.SendData "HELO www.sohu.com" & vbCrLf

Debug.Print "HELO www.sohu.com"
Case 1
m_State = MAIL_FROM
Winsock1.SendData "mail from: " & Chr(32) & "wansijei@sohu.com" & vbCrLf
Debug.Print "MAIL FROM: wansijei@sohu.com"
Case 2
m_State = MAIL_RCPTTO
Winsock1.SendData "rcpt to: wansijei@sohu.com" & vbCrLf
Debug.Print "RCPT TO: wansijei@sohu.com"
Case 3
m_State = MAIL_DATA
Winsock1.SendData "data" & vbCrLf
Debug.Print "DATA"
Case 4

m_State = MAIL_DOT
Winsock1.SendData "Subject: " & "wwwwwwwwwwwwwtext" & vbCrLf
Winsock1.SendData "text" & vbCrLf
Winsock1.SendData "." & vbCrLf
Case 5
m_State = MAIL_QUIT
Winsock1.SendData "QUIT" & vbCrLf
Debug.Print "QUIT"


Case 6
Winsock1.Close
Command1.Enabled = True
MsgBox "OK"
Winsock1.Close
End Select

Else

Winsock1.Close
MsgBox "SMTP ERRor:" & strServerResponse, vbInformation, "SMTP Error"
' Command1.Enabled = True
End If
End Sub

Private Sub Winsock1_Error(ByVal Number As Integer, Description As String, ByVal Scode As Long, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, CancelDisplay As Boolean)
MsgBox "WinSock Error Number " & Number & vbCrLf & Description, vbExclamation, "WinSock Error"
End Sub
...全文
34 14 打赏 收藏 转发到动态 举报
写回复
用AI写文章
14 条回复
切换为时间正序
请发表友善的回复…
发表回复
xiaohuangtao 2003-11-10
  • 打赏
  • 举报
回复
说错了阿,是没人看,还说很多难听的话。好像公开代码还有什么错似的。唉,现在的人哪。
xiaohuangtao 2003-11-10
  • 打赏
  • 举报
回复
以前本来是开放全部代码的,结果每人看,所以我一气愤,干脆不共享代码了

大家理解一下心情哈。
xiaohuangtao 2003-11-10
  • 打赏
  • 举报
回复
马上发过来了,但是请大家还是支持一下我阿,多多点击
http://www.cnkernel.com 的SMARTMAILa阿,多提点意见,本人感激不尽
redwrite 2003-11-10
  • 打赏
  • 举报
回复
to : xiaohuangtao(绿毛网虫)
我也想往这方面做,给我发一个吧,谢谢
Redwrite@sina.com
szlili2013 2003-11-10
  • 打赏
  • 举报
回复
也给我一个吧,我也正想做方面的。thk!!
szwyl@tom.com
zixing 2003-11-06
  • 打赏
  • 举报
回复
楼上的哥哥,我要个哦,你给我个好了,thank you ~~~~~~~~~
e:zisezhixing@163.com
Dennis618 2003-11-05
  • 打赏
  • 举报
回复
學習.
planetike 2003-11-05
  • 打赏
  • 举报
回复
ASP发邮件的程序。
<%
Function SendMail(Email,name,subject,message)
Set MailToSend = CreateObject("CDONTS.Newmail")'initialize the variable
MailToSend.TO = "<" & Email & ">" 'Mail to.... enclose email address in the bracket
MailToSend.From = name ' 'Mail from
MailToSend.Subject = subject ' subject
MailToSend.Body = message ' message to send
MailToSend.Importance=1 ' priority of this message
MailToSend.send ' send
Set MailToSend=nothing ' deinitialize the variable
SendMail=1
End Function

dim Email,name,subject,message,num
Email=request("Email")
name="planetike@hotmail.com"
subject=request("subject")
message=request("message")
if trim(email)<>"" then
num=SendMail (Email,name,subject,message)
response.write("1 Email send to " & Email & " success!")
Email=""
end if
%>
<html>
<head>
<title>邮件发送</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name="form1" method="post" action="index.asp">
<table width="53%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="23" width="20%">E_mail:</td>
<td height="23" width="80%">
<input type="text" name="Email" size="60">
</td>
</tr>
<tr>
<td height="29" width="20%">subject:</td>
<td height="29" width="80%">
<input type="text" name="subject" size="60">
</td>
</tr>
<tr>
<td height="31" width="20%">message:</td>
<td height="31" width="80%">
<textarea name="message" rows="18" cols="60"></textarea>
</td>
</tr>
<tr>
<td height="31" width="20%"> </td>
<td height="31" width="80%">
<div align="center">
<input type="submit" name="Submit" value="提 交">
  
<input type="reset" name="Submit2" value="重 置">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>
xiaohuangtao 2003-11-05
  • 打赏
  • 举报
回复

最新下载地址:
http://www.cnkernel.com/


我写的一个邮件软件,集成多种文件传送方式.
和OUTLOOK差不了多少!!有邮件DEMO提供,完全脱离OUTLOOK.可以提供所有VB源码.
给个邮件地址,发过去!
  • 打赏
  • 举报
回复
友情UP
yijiansong 2003-09-16
  • 打赏
  • 举报
回复
学习
imur 2003-09-16
  • 打赏
  • 举报
回复
up
jlum99 2003-09-12
  • 打赏
  • 举报
回复
看看你的另一帖我的回复
aksoft 2003-09-12
  • 打赏
  • 举报
回复
看看,我是初学者

1,502

社区成员

发帖
与我相关
我的任务
社区描述
VB 网络编程
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧