0
我是VB表單的新手,但需要一些建議,如果這是可能的。我想通過電子郵件將表單字段作爲單行管道分隔文本文件附件。所以,當您打開發送的電子郵件將有* .txt文件並連接1號線看起來像這樣VB表單作爲附件在文本文件中發送表單域的電子郵件
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("[email protected]"))
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
任何想法將不勝讚賞
謝謝!
我可以得到的代碼發送後自動刪除它自動? – user1802739
只是谷歌它 - 或鍵入'My.Computer.FileSystem.',看看接下來會發生什麼 –
My.Computer.FileSystem.WriteAllText(filename,「value1 | value2 | value3」) – user1802739