My problem, however, is that all these listings use external software like OUTLOOK, THUNDERBIRD etc. and not work only with system tools!
In my case I have to send the emails via TOBIT / DAVID, because a corresponding server is installed for the e-mail traffic! This cannot be changed!
- That's why I'm looking for a generally applicable solution. See4VB is a solution, but unfortunately I can't get it to work! - The program logs on to the GMX server sucessfully, but it exits when logging into the email account (sender mail and user password)!
And I don't know why!
Here is the listing for sned a mail via see4vb.
Link for runtime see massage from user "wbtcpip" =>
www.marshallsoft.com/see4vb.htmAccording his statement it should be perfect work with GFA Basic 32! - Unfortunately no GFA listing was send or is available! Additional it is not free. Works only time limeted: 30 days!
Declare Function seeAttach Lib "SEE32.DLL" (ByVal NbrChans As Long, ByVal KeyCode As Long) As Long
Declare Function seeClose Lib "SEE32.DLL" (ByVal Chan As Long) As Long
Declare Function seeErrorText Lib "SEE32.DLL" (ByVal Chan As Long, ByVal Code As Long, ByVal Buffer As String, ByVal BufLen As Long) As Long
Declare Function seeIntegerParam Lib "SEE32.DLL" (ByVal Chan As Long, ByVal Index As Long, ByVal Value As Long) As Long
Declare Function seeRelease Lib "SEE32.DLL" () As Long
Declare Function seeSendEmail Lib "SEE32.DLL" (ByVal Chan As Long, ByVal Rcpt As String, ByVal CC As String, ByVal BCC As String, ByVal Subj As String, ByVal Msg As String, ByVal Attach As String) As Long
Declare Function seeSetProxySSL Lib "SEE32.DLL" (ByVal ProxyCode As Long, ByVal ProxyFlags As Long, ByVal ProxyDir As String, ByVal ProxyCert As String, ByVal ProxyExe As String) As Long
Declare Function seeSmtpConnectSSL Lib "SEE32.DLL" (ByVal Chan As Long, ByVal ProxyPort As Long, ByVal SmtpPort As Long, ByVal SmtpServer As String, ByVal User As String, ByVal Pass As String, ByVal From As String, ByVal Reply As String, ByVal ProxyIP As String) As Long
Declare Function seeStringParam Lib "SEE32.DLL" (ByVal Chan As Long, ByVal Index As Long, ByVal Value As String) As Long
Private Const SEE_LOG_FILE As Integer = 20
Private Const STUNNEL_TASKBAR_ICON As Integer = 1
Private Const STUNNEL_DISABLE_LOGGING As Integer = 2
Private Const SEE_KEY_CODE As Long = 0 ' Demoversion Zeitlich begrenzt!
Dim gLocalDir As String ' local directory
Dim gLogFile As String ' log file
Dim gSmtpUser As String ' SMTP user
Dim gSmtpPass As String ' SMTP password
Dim gSmtpHost As String ' SMTP server
Dim gLogPathName As String ' log file name
Dim gEmailDir As String ' email Directory
Dim gAttachDir As String ' attachmenst diretory
Dim gSmtpPort As Integer ' SMTP server port - normally 465 or 587.
Dim gProxyPort As Integer ' proxy port (to contact proxy on)
Dim gProxyDir As String ' proxy server directory
Dim gProxyExe As String ' proxy server executable
Dim gProxyCert As String ' proxy server certificate (PEM format)
Dim gEmailTo As String ' recipient
Dim gEmailFrom As String ' sender
Dim gEmailSubj ' subject
Dim gEmailMsg ' message
Dim gEmailAttach ' attachment filenames
MailSSL()
Sub ShowError(ByVal ErrCode As Long, ErrText As String)
Dim Code As Long
Dim Buffer As String
Dim Temp As String
Buffer = "SEE Error " + LTrim(Str(ErrCode))
Temp = Space(128)
Code = seeErrorText(0, ErrCode, Temp, 127)
If Code > 0 Then
Buffer = Buffer + Chr$(13) + Chr$(10) + Left(Temp, Code)
End If
Buffer = Buffer + Chr$(13) + Chr$(10) + ErrText
MsgBox (Buffer)
End Sub
Sub SendEmail()
Dim I As Integer
Dim N As Integer
Dim Code As Long
Dim KeyCode As Long
Dim FileName As String
If Left(gSmtpHost, 1) = "!" Then
MsgBox("You must edit variables gSmtpHost thru gEmailTo before running")
Exit Sub
End If
' attach SEE
KeyCode = SEE_KEY_CODE
Code = seeAttach(1, KeyCode)
If Code < 0 Then
MsgBox ("Error " + Str(Code) + " attaching SEE")
' NOTE: check SEE_KEY_CODE (use 0 for evaluation version)
Exit Sub
End If
' enable logging
MsgBox("Log file = " + gLogPathName)
Code = seeStringParam(0, SEE_LOG_FILE, gLogPathName)
' pass SMTP proxy server info to SEE
Code = seeSetProxySSL(0, 1, gProxyDir, gProxyCert, gProxyExe)
If Code < 0 Then
' error in format
Call ShowError(Code, "Cannot set proxy")
Exit Sub
Else
MsgBox("Proxy parameters set")
End If
' ready to connect to SMTP server
MsgBox ("Connecting to " + gSmtpHost + " as user " + gSmtpUser + " on port " + Str(gSmtpPort))
Code = seeSmtpConnectSSL(0, gProxyPort, gSmtpPort, gSmtpHost, gSmtpUser, gSmtpPass, gEmailFrom, gEmailFrom, Chr(0))
' ok ?
If Code < 0 Then
Call ShowError(Code, "seeSmtpConnectSSL fails")
Exit Sub
End If
' send the email
MsgBox("Connected to SMTP server, sending mail...")
Code = seeSendEmail(0, gEmailTo, Chr(0), Chr(0), gEmailSubj, gEmailMsg, gEmailAttach)
If Code < 0 Then
' error attempting to send email
Call ShowError(Code, "seeSendEmail fails ")
Exit Sub
End If
' all done
Code = seeClose(0)
MsgBox("Email has been sent")
End Sub
Sub MailSSL()
Dim Code As Long
' *** BEG-PROGRAMMER: Edit the following lines ***
gLocalDir = "C:\SEE4VB\APPS\" ' local directory (ends with \)
gAttachDir = "C:\SEE4VB\APPS\" + Chr(0) ' directory for email
gEmailDir = "C:\SEE4VB\APPS\" + Chr(0) ' directory fpor attachments
gProxyPort = 8801 ' proxy port (to contact proxy on)
gProxyDir = "C:\SEE4VB\SSL\" + Chr(0) ' proxy server directory
gProxyExe = "C:\SEE4VB\SSL\stunnel.exe" + Chr(0) ' proxy server executable
gProxyCert = "C:\SEE4VB\SSL\stunnel.pem" + Chr(0) ' proxy server certificate (PEM format)
gEmailSubj = "vbaMailSSL Test" + Chr(0) ' email subject
gEmailMsg = "vbaMailSSL Test" + Chr(13) + Chr(10) + "-MarshallSoft" + Chr(0) ' email message (or filename if prefixed with+ Chr(0) '@')
gSmtpPort = 587 ' SMTP server port - normally 465 or 587.
gSmtpHost = "mail.gmx.net" + Chr(0) ' SMTP server name
gSmtpUser = "77275684" + Chr(0) ' SMTP user name (must changed)
gSmtpPass = "S33444-S592701" + Chr(0) ' SMTP password for above user (must changed)
gEmailFrom = "<a.b@gmx.de>" + Chr(0) ' Your email address (brackets required) (must changed)
gEmailTo = "<b.b@gmx.de>" + Chr(0) ' EmailTo email address (brackets required) (must changed)
gEmailAttach = Chr(0)
' *** END-PROGRAMMER ***
gLogFile = "vbaMailSSL.log"
gLogPathName = gLocalDir + gLogFile
' send the mail
Call SendEmail()
Code = seeRelease()
End Sub