Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click ' SMTPサーバーを指定する Dim client As New SmtpClient("pastelsoft.sakura.ne.jp") ' 送信元、あて先、件名、本文を設定する Dim fromAddress As String = "pocota@pastelsoft.sakura.ne.jp" Dim toAddress As String = "hi@poc.jp" Dim subject As String = TextBox1.Text Dim body As String = TextBox2.Text Try ' 送信する client.Send(fromAddress, toAddress, subject, body) MessageBox.Show("送信しました") Catch ex As SmtpException ' SMTPサーバーへの接続に失敗した場合 MessageBox.Show(ex.Message) End Try End Sub End Class