Link to home
Start Free TrialLog in
Avatar of MariaHalt
MariaHaltFlag for United States of America

asked on

Using vbSendMail.dll to issue emails, the email admin what's to know how it works

This question is not about coding for vbSendMail but rather the question is:  what is it really doing?  Our email admin wants to know.  To be honest, I don't care, the emails are being issued so I'm a happy programmer, however, the potential to issue thousands of emails is not sitting well with the email admin.  She's concerned about traffic/load on the server.  Can someone explain it to me in simple terms so that I can explain it to her?

Here is my code:

If SendAnEmail (strUserEmail, "", "", Trim(txtSubject.Text), Trim(txtMessage.Text), strAttachments, strMSOutlookEmail, strMSOutlook, strMSOutlookEmailPwd) = False Then
     MsgBox "Email failed", vbexclamation, "Attention"
End If


Where:

Function SendAnEmail (ByVal strRecipients As String, ByVal strCC As String, ByVal strBCC As String, ByVal strSubject As String, ByVal strMessage As String, ByVal strAttachments As String, ByVal strFromEmail As String, ByVal strEmailAcct As String, ByVal strEmailAcctPwd As String) As Boolean

'To use this function, SMTP Send Mail for VB6.0 must be referenced!
Dim objMailer As New vbSendMail.clsSendMail

On Error GoTo SendAnEmail_EH
 
SendAnEmail = False

objMailer.Message = strMessage
objMailer.Subject = strSubject
objMailer.From = strFromEmail
objMailer.SMTPHost = "OUR MAIL SERVER NAME>"
objMailer.Delimiter = ";"
objMailer.Recipient = strRecipients
objMailer.CcRecipient = strCC
objMailer.BccRecipient = strBCC
objMailer.Attachment = strAttachments
objMailer.MaxRecipients = 4000
objMailer.UseAuthentication = True
objMailer.UserName = strEmailAcct
objMailer.Password = strEmailAcctPwd
         
Select Case objMailer.Connect
    Case False
       'Return an error
       SendAnEmail = False
    Case True
        objMailer.send
       'Return a success-message
        objMailer.Disconnect
        SendAnEmail = True
End Select
   
Set objMailer = Nothing

Exit Function

SendAnEmail_EH:
    MsgBox "Message from SendAnEmail_EH" & vbCrLf & vbCrLf & "Unable to send an email." & vbCrLf & vbCrLf & "Error " & Err.Number & ". " & Err.Description, vbExclamation, strContactMaria
End Function
Avatar of Shanmuga Sundaram D
Shanmuga Sundaram D
Flag of India image

Very simple. The code that you had posted will get the emailaddress, message, subject and attachment from the user and will send it to the specified mail address. if it is not successful then  it will display the error mentioned in the msgbox. if it is success then it will not display any message. They have used one function to perform this task. this comes after the block that I copied and pasted below.

If SendAnEmail (strUserEmail, "", "", Trim(txtSubject.Text), Trim(txtMessage.Text), strAttachments, strMSOutlookEmail, strMSOutlook, strMSOutlookEmailPwd) = False Then
     MsgBox "Email failed", vbexclamation, "Attention"
End If

Avatar of MariaHalt

ASKER

I know what the code does, I wrote it.  I just want to know what effect it has on the server.
From glancing at the source code for vbSendMail (http://www.freevbcode.com/ShowCode.Asp?ID=109) I believe it makes WinSock calls directly to the SMTP server.  
I haven't looked at it too much but it is available.  
Now we're getting somewhere...please allow me to explain more.  The VB app that's using the vbSendMail allows the user to issue emails quickly by custom selecting from a pool of students (with various options to filter for by course, instructor, citizenship, academic level, activities, etc...).  The user can not do this in MSOutlook  without selecting each student's name from the Global list (b/c it's very time consuming and user may not know the names of the students anyway and the enrollment changes constantly so setting up distribution lists are out of the question too).  

The email admin is concerned about the load on the email server as opposed to using MSOutlook.  Is the load greater or lesser?  (There are no sent items recorded in the users MSOutlook folder so my guess is it is lesser).  But I need to explain this to her in terms she can quantify.

Usually,  I code stuff and if it works, I don't question how.  But this time I need to explain the routing I guess.  Please help!
ASKER CERTIFIED SOLUTION
Avatar of Mirtheil
Mirtheil
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
That's a good idea...thanks.