NSDEasySendMail クラスを使用したサンプル


●サンプルの一覧

内容 詳細
宛先(To)にメールを送信します。 宛先(To)にメールを送信します。
宛先(To)にメールをポート番号587を使用して送信します。
宛先(To)にメールをポート番号587、SSL(STARTTLS)を使用して送信します。
宛先(To)にメールをポート番号465、SSLを使用して送信します。
宛先(To)に添付ファイル付のメールを送信します。 宛先(To)に添付ファイル付のメールを送信します。
宛先(To)に複数の添付ファイル付メールを送信します。
宛先(To、Cc)にメールを送信します。 宛先(To、Cc)にメールを送信します。
宛先(To、Cc)に添付ファイル付メールを送信します。
宛先(To、Cc、BCc)にメールを送信します。 宛先(To、Cc、BCc)にメールを送信します。
宛先(To、BCc)にメールを送信します。
宛先(To、Cc、BCc)に複数の添付ファイル付メールを送信します。
宛先(複数のTo、複数のCc、複数のBCc)に複数の添付ファイル付メールを送信します。

●宛先(To)にメールを送信します。

○宛先(To)にメールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:@メールを送信します。

○宛先(To)にメールをポート番号587を使用して送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' ポート番号を設定します。
        Dim Int_Port As Integer  = 587

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Int_Port) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:@メールを送信します。

○宛先(To)にメールをポート番号587、SSL(STARTTLS)を使用して送信します。

(一般的にSMTP over SSL(STARTTLS)での送信。)

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' ポート番号を設定します。
        Dim Int_Port As Integer  = 587
        ' SSLの使用有無を設定します。
        Dim Bln_SSL As Boolean = True
        ' STARTTSLの有無を設定します。
        Dim Bln_STARTTSL As Boolean = True

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Int_Port , _
                                          Bln_SSL , _
                                          Bln_STARTTSL ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:@メールを送信します。

○宛先(To)にメールをポート番号465、SSLを使用して送信します。

(一般的にSMTP over SSLまたはSMTP-Auth over SSLでの送信。)

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' ポート番号を設定します。
        Dim Int_Port As Integer  = 465
        ' SSLの使用有無を設定します。
        Dim Bln_SSL As Boolean = True

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Int_Port , _
                                          Bln_SSL ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:@メールを送信します。


●宛先(To)に添付ファイル付のメールを送信します。

○宛先(To)に添付ファイル付のメールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile As String = "C:\Data\Test.dat"

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:A添付ファイル付のメールを送信します。

○宛先(To)に複数の添付ファイル付メールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = {"C:\Data\Test.dat", "C:\Data\Test1.dat"}

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:B複数の添付ファイル付メールを送信します。


●宛先(To、Cc)にメールを送信します。

○宛先(To、Cc)にメールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test2@xxxx.xx.xx" または "TEST2<test2@xxxx.xx.xx>"
        Dim Str_CcAddress As String = "test2@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = Nothing

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:CCcのアドレスを設定したメールを送信します。

○宛先(To、Cc)に添付ファイル付メールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test2@xxxx.xx.xx" または "TEST2<test2@xxxx.xx.xx>"
        Dim Str_CcAddress As String = "test2@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = {"C:\Data\Test.dat", "C:\Data\Test1.dat"}

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:CCcのアドレスを設定したメールを送信します。


●宛先(To、Cc、BCc)にメールを送信します。

○宛先(To、Cc、BCc)にメールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test2@xxxx.xx.xx" または "TEST2<test2@xxxx.xx.xx>"
        Dim Str_CcAddress As String = "test2@xxxx.xx.xx"
        ' 宛先(BCc)のメールアドレスを設定します。
        '   例:"test3@xxxx.xx.xx" または "TEST3<test3@xxxx.xx.xx>"
        Dim Str_BCcAddress As String = "test3@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = Nothing

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_BCcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:DCc、Bccのアドレスを設定したメールを送信します。

○宛先(To、BCc)にメールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test2@xxxx.xx.xx" または "TEST2<test2@xxxx.xx.xx>"
        Dim Str_CcAddress As String = Nothing
        ' 宛先(BCc)のメールアドレスを設定します。
        '   例:"test3@xxxx.xx.xx" または "TEST3<test3@xxxx.xx.xx>"
        Dim Str_BCcAddress As String = "test3@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = Nothing

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_BCcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:DCc、Bccのアドレスを設定したメールを送信します。

○宛先(To、Cc、BCc)に複数の添付ファイル付メールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "test1@xxxx.xx.xx"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test2@xxxx.xx.xx" または "TEST2<test2@xxxx.xx.xx>"
        Dim Str_CcAddress As String = "test2@xxxx.xx.xx"
        ' 宛先(BCc)のメールアドレスを設定します。
        '   例:"test3@xxxx.xx.xx" または "TEST3<test3@xxxx.xx.xx>"
        Dim Str_BCcAddress As String = "test3@xxxx.xx.xx"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = {"C:\Data\Test.dat", "C:\Data\Test1.dat"}

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_BCcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:DCc、Bccのアドレスを設定したメールを送信します。

○宛先(複数のTo、複数のCc、複数のBCc)に複数の添付ファイル付メールを送信します。

Public Class Form1

    ' メールを送信します.
    Private Sub Button1_Click( ByVal sender As System.Object, _
                               ByVal e As System.EventArgs _
                             ) Handles Button1.Click
        Dim Str_SmtpServer As String = ""        ' <- SMTPサーバーの名前を設定します。
        Dim Str_AccountName As String = ""       ' <- アカウント名を設定します。
        Dim Str_Password As String = ""          ' <- パスワードを設定します。
        Dim Str_FromAddress As String = ""       ' <- 差出人のメールアドレスを設定します。
                                                 '       例:"test@xxxx.xx.xx" または "TEST<test@xxxx.xx.xx>"
        ' 宛先(To)のメールアドレスを設定します。
        '   例:"test1@xxxx.xx.xx" または "TEST1<test1@xxxx.xx.xx>"
        Dim Str_ToAddress As String = "テスト1<test1@xxxx.xx.xx>;テスト2<test2@xxxx.xx.xx>"
        ' 宛先(Cc)のメールアドレスを設定します。
        '   例:"test3@xxxx.xx.xx" または "TEST3<test3@xxxx.xx.xx>"
        Dim Str_CcAddress As String = "テスト3<test3@xxxx.xx.xx>;テスト4<test4@xxxx.xx.xx>"
        ' 宛先(BCc)のメールアドレスを設定します。
        '   例:"test5@xxxx.xx.xx" または "TEST5<test5@xxxx.xx.xx>"
        Dim Str_BCcAddress As String = "テスト5<test5@xxxx.xx.xx>;テスト6<test6@xxxx.xx.xx>"
        ' 件名を設定します。
        Dim Str_Subject As String = "テストメールです。"
        ' 本文を設定します。
        Dim Str_Text As String = "テストメール。"  & vbCrLf & "このメールはテスト送信用メールです。"
        ' 添付ファイルを設定します。
        Dim Str_AttachmentFile() As String = {"C:\Data\Test.dat", "C:\Data\Test1.dat"}

        Using Cls_EasyMail As New NSDEasySendMail
            If Cls_EasyMail.EasySendMail( Str_SmtpServer , _
                                          Str_AccountName, _
                                          Str_Password, _
                                          Str_FromAddress , _
                                          Str_ToAddress , _
                                          Str_CcAddress , _
                                          Str_BCcAddress , _
                                          Str_Subject , _
                                          Str_Text , _
                                          Str_AttachmentFile ) Then
                MsgBox("送信しました。")
            Else
                MsgBox("送信に失敗しました。" & vbCrLf & ClsEasyMail.GetErrMsg())
            End If
        End Using
    End Sub
End Class

メッソッドの説明:DCc、Bccのアドレスを設定したメールを送信します。


Copyright (C) 2009-2012 Nihon System Developer Corp. All Rights Reserved.