📄 formtest.frm
字号:
VERSION 5.00
Object = "{6484C000-AFB3-11D2-A03C-004005405625}#1.0#0"; "DartMail.dll"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "mscomctl.ocx"
Object = "{648A5603-2C6E-101B-82B6-000000000014}#1.1#0"; "MSCOMM32.OCX"
Object = "{C330114C-8968-4469-83D1-736DE1640031}#12.3#0"; "alasunsmscon.ocx"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 7035
ClientLeft = 60
ClientTop = 450
ClientWidth = 10050
LinkTopic = "Form1"
ScaleHeight = 7035
ScaleWidth = 10050
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "Frame1"
Height = 5895
Left = 6000
TabIndex = 12
Top = 120
Width = 3855
Begin VB.TextBox Text7
Height = 375
Left = 1080
TabIndex = 16
Text = "Text7"
Top = 360
Width = 2655
End
Begin VB.TextBox Text6
Height = 375
Left = 1080
TabIndex = 15
Text = "Text6"
Top = 1080
Width = 2655
End
Begin VB.TextBox Text5
Height = 375
Left = 1080
TabIndex = 14
Text = "Text5"
Top = 1680
Width = 2655
End
Begin VB.TextBox Text41
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 3375
Left = 720
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 13
Top = 2280
Width = 3015
End
Begin VB.Label Label6
Caption = "subject"
Height = 375
Left = 240
TabIndex = 22
Top = 1680
Width = 735
End
Begin VB.Label Label5
Caption = "to"
Height = 375
Left = 240
TabIndex = 21
Top = 1080
Width = 735
End
Begin VB.Label Label4
Caption = "from"
Height = 375
Left = 120
TabIndex = 20
Top = 360
Width = 855
End
End
Begin VB.CommandButton Command5
Caption = "发送邮件"
Height = 375
Left = 7440
TabIndex = 11
Top = 6240
Width = 1575
End
Begin VB.CommandButton Command4
Caption = "接收邮件"
Height = 375
Left = 2040
TabIndex = 10
Top = 6240
Width = 1455
End
Begin VB.CommandButton Command3
Caption = "GB>GB"
Height = 375
Left = 4560
TabIndex = 9
Top = 2640
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "GB>JIS"
Height = 375
Left = 4560
TabIndex = 8
Top = 2040
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "JIS>GB"
Height = 375
Left = 4560
TabIndex = 7
Top = 1320
Width = 1215
End
Begin VB.Frame Frame1
Caption = "Frame1"
Height = 5895
Left = 360
TabIndex = 2
Top = 120
Width = 3855
Begin VB.TextBox text4
BackColor = &H00C0C0C0&
BeginProperty Font
Name = "Arial"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 3375
Left = 720
MultiLine = -1 'True
ScrollBars = 3 'Both
TabIndex = 6
Top = 2280
Width = 3015
End
Begin VB.TextBox Text3
Height = 375
Left = 960
TabIndex = 5
Text = "Text3"
Top = 1680
Width = 2655
End
Begin VB.TextBox Text2
Height = 375
Left = 960
TabIndex = 4
Text = "Text2"
Top = 1080
Width = 2655
End
Begin VB.TextBox Text1
Height = 375
Left = 960
TabIndex = 3
Text = "Text1"
Top = 360
Width = 2655
End
Begin VB.Label Label3
Caption = "subject"
Height = 255
Left = 120
TabIndex = 19
Top = 1800
Width = 615
End
Begin VB.Label Label2
Caption = "to"
Height = 255
Left = 120
TabIndex = 18
Top = 1200
Width = 495
End
Begin VB.Label Label1
Caption = "from"
Height = 375
Left = 120
TabIndex = 17
Top = 360
Width = 495
End
End
Begin MSComctlLib.StatusBar StatusBar
Align = 2 'Align Bottom
Height = 375
Left = 0
TabIndex = 23
Top = 6660
Width = 10050
_ExtentX = 17727
_ExtentY = 661
_Version = 393216
BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628}
NumPanels = 4
BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 4410
MinWidth = 4410
EndProperty
BeginProperty Panel2 {8E3867AB-8586-11D1-B16A-00C0F0283628}
Object.Width = 3528
MinWidth = 3528
EndProperty
BeginProperty Panel3 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
BeginProperty Panel4 {8E3867AB-8586-11D1-B16A-00C0F0283628}
EndProperty
EndProperty
End
Begin VB.Frame FrameOCX
Caption = "FrameOCX"
Height = 1815
Left = 120
TabIndex = 0
Top = 3120
Visible = 0 'False
Width = 3735
Begin VB.Timer Timermain
Interval = 100
Left = 1560
Top = 360
End
Begin VB.FileListBox Filelist
Height = 990
Left = 2520
Pattern = "*.TXT"
TabIndex = 1
Top = 360
Width = 1095
End
Begin alasun.alasunsms alasunsms1
Left = 1320
Top = 960
_ExtentX = 979
_ExtentY = 979
End
Begin MSCommLib.MSComm MSComm1
Left = 240
Top = 960
_ExtentX = 1005
_ExtentY = 1005
_Version = 393216
CommPort = 5
DTREnable = -1 'True
RThreshold = 2
SThreshold = 1
End
Begin DartMailCtl.Smtp Smtp1
Left = 240
OleObjectBlob = "Formtest.frx":0000
Top = 360
End
Begin DartMailCtl.Pop Pop1
Left = 960
OleObjectBlob = "Formtest.frx":0032
Top = 360
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text41.Text = ShiftJIS2GB(text4.Text)
End Sub
Private Sub Command2_Click()
Text41.Text = GB2ShiftJIS(text4.Text)
End Sub
Private Sub Command4_Click()
On Error GoTo OnError
MailInCount = 0
' clear message object
Pop1.Messages.Clear
Pop1.Timeout = 10000
Pop1.Login "mail.jptocn.net", "post@jptocn.net", "lhb7802#"
If Pop1.Count = 0 Then '如果邮件服务器上没有邮件,则退出进程,等待下一次触发
Pop1.Logout
Else '如果邮件服务器上有邮件,则收取邮件并写入邮件队列
Pop1.Get
StatusBar.Panels(1).Text = "待收邮件:" & Pop1.Count
Dim Msg As Message
Dim n As Long
Dim lvi As ListItem
'使用2维动态数组来保存接收的邮件,这样可以减少对数据库的频繁操作而带来的对服务器的压力
MailInCount = Pop1.Messages.Count
Set Msg = Pop1.Messages.Item(1)
Text1.Text = Trim(FromAddress(Msg.From))
Text6.Text = Trim(FromAddress(Msg.From)) '发信地址,作为帐号
Text2.Text = Trim(Toaddress(Msg.Content))
Text7.Text = Trim(Toaddress(Msg.Content)) '目标地址,提取手机号码
Text3.Text = Trim(Msg.Subject) '主题
text4.Text = Trim(Msg.Text) '信件内容
'调试期间,删除服务器上的邮件
Pop1.Delete (1)
Pop1.Logout
End If
OnError:
If BadStatusMessage <> "" Then
StatusBar.Panels(1).Text = "ERROR:邮件接收错误 "
BadStatusMessage = ""
End If
End Sub
Private Sub Mail_sent()
On Error GoTo OnError
StatusBar.Panels(1).Text = "Sending Message ... "
Smtp1.Abort
DSN = dsnNever
Smtp1.Login "mail.jptocn.net", 25, "post@jptocn.net", "lhb7802#"
Smtp1.Timeout = 10000
Smtp1.DSN DSN
Smtp1.Capabilities.Clear
Smtp1.Capabilities.Add "8BITMIME"
With Smtp1.Message
' Clear any existing Content
.Content = ""
.From = "post@jptocn.net"
'.From = Smtpname
.To.Clear
.To.Add "hui.cao@toho-jp.com"
.Subject = ""
'.AddText GB2ShiftJIS(Trim(MailOutLine(6, i))) + vbCrLf
.AddText (Text41.Text) + vbCrLf
End With
Smtp1.Send
Smtp1.Logout
'发送完毕,清空邮件发送队列内容
OnError:
If BadStatusMessage <> "" Then
StatusBar.Panels(1).Text = "ERROR: " + BadStatusMessage
BadStatusMessage = ""
End If
End Sub
Private Sub Command5_Click()
Mail_sent
End Sub
Private Sub Smtp1_Progress(ByVal Method As DartMailCtl.SmtpMethodConstants, ByVal Status As DartMailCtl.SmtpStatusConstants, ByVal Reply As String, ByVal Count As Long, ByVal Size As Long)
Debug.Print "***********************************"
Debug.Print "On Progress: "
Debug.Print "Reply = " & Reply
Debug.Print "Count = " & Count
Debug.Print "Size = " & Size
Debug.Print
If Method = smtpSend Then
If Status = smtpSending Then
Dim n As Double
n = (CDbl(Count) / CDbl(Size)) * 100
If n > 100 Then n = 100
'Progress.Value = n
ElseIf Status = smtpOk Then
'Progress.Value = 0
End If
End If
If Status = smtpBad And BadStatusMessage = "" Then
BadStatusMessage = Reply
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -