bsmtp64.dll は、VBAから Declare文によるAPI呼出しをサポートします。 API一覧は、以下の通りです。
VBAでの使用例。
Private Declare PtrSafe Function SendMail Lib "C:\B21soft\bsmtp64.dll" _ (szServer As String, szTo As String, szFrom As _ String, szSubject As String, szBody As String, szFile As String) As String Private Declare PtrSafe Function RcvMail Lib "C:\B21soft\bsmtp64.dll" _ (szServer As String, szUser As String, szPass As String, _ szCommand As String, szDir As String) As Variant Private Declare PtrSafe Function ReadMail Lib "C:\B21soft\bsmtp64.dll" _ (szmailfile As String, szpara As String, szDir As String) As Variant Private Declare PtrSafe Function FlushMail Lib "C:\B21soft\bsmtp64.dll" _ (szServer As String, szDir As String, szLogfile As String) As Long Sub SendMailTest() Dim szServer As String Dim szTo As String Dim szFrom As String Dim szSubject As String Dim szBody As String Dim szFile As String Dim msg As String szServer = "smtp.mail.yahoo.co.jp:465" 'szServer = "C:\wk\VBA\MQ" FlushMail用にメールキューに作成 szTo = "xxxx@xxxxxx.com" szFrom = "xxxx@yahoo.co.jp,uuuuu:pppppp" szSubject = "こんにちは!" szBody = "お疲れ様" & vbCrLf & "さようなら。" szFile = "" msg = SendMail(szServer, szTo, szFrom, szSubject, szBody, szFile) Debug.Print msg End Sub Sub RcvMailTest() Dim re As Variant ret = RcvMail("pop.mail.yahoo.co.jp:995", "uuuuu", "pppp", "save 1-2", "c:\wk\vba") If Not IsArray(ret) Then Debug.Print ret Else Dim re2 As Variant Dim mailfile As String For Each m In ret mailfile = m re2 = ReadMail(mailfile, "To:From:Subject:", "c:\wk\vba") For Each Line In re2 Debug.Print Line Next Next End If End Sub