我是 VB 表单的新手,但如果可能的话,我需要一些建议。我想将表单字段作为单行管道分隔的文本文件附件通过电子邮件发送。因此,当您打开发送的电子邮件时,它将附加 *.txt 文件,第一行将如下所示
textbox1_value|textbox2_value|textbox3_value
这是我的电子邮件代码:
Imports System.Net.Mail
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Using message As New MailMessage()
'set to the from, to and subject fields
message.From = New MailAddress(TextBox2.Text.ToString())
message.[To].Add(New MailAddress("steve@steve.com"))
message.Subject = "Certificate alert"
'code the message body
Dim MsgBody As String
MsgBody = TextBox2.Text.ToString() & vbCr & _
TextBox3.Text.ToString() & vbCr & _
TextBox4.Text.ToString()
message.Body = MsgBody
Dim client As New SmtpClient()
client.Host = "mailhost"
client.Send(message)
End Using
'display submitted box
MessageBox.Show("Your Incident has been submitted!", "Congratulations!")
'close form
Me.Close()
End Sub
End Class
任何想法将不胜感激
谢谢!