Ken,
I'm needing to change the way this workbook emails out. Prior I was using Outlook, but I'm noticing that the email is sitting in the outbox for an extended period of time. I have it set to auto send/receive. I've thought about using smtp instead for instant sending. Our company runs on and exchange server. I've found some code that is supposed to send via smtp, but have some quesitons. Is it as simple as replacing the existing code in the userform or does further change need to take place, also since we have so many users of this workbook, is there a way to automatically have the code fill in the username and password for their exchange email account?

Here is the code I've found, does it look like it will work for what I need?
Code:
 
  1. Public Function Mail_SMTP(strNTUserName As String, strNTUserPwd As String, _
  2. strFrom As String, strTo As String, Optional strSubject As String, _
  3. Optional strBody As String, Optional strBCC As String, _
  4. Optional strCC As String, Optional strAttachment As String, _
  5. Optional strHTMLBody As String, Optional strMailServer As String = "10.2.0.32")
  6. On Error GoTo ErrHandler
  7. Dim email As New CDO.Message
  8. With email
  9. .From = strFrom
  10. .To = strTo
  11. If (Len(strAttachment) > 0) Then .AddAttachment strAttachment
  12. If (Len(strHTMLBody) > 0) Then .HTMLBody = strHTMLBody '"<H4>See attached file</H4>"
  13. If (Len(strBCC) > 0) Then .BCC = strBCC
  14. If (Len(strCC) > 0) Then .CC = strCC
  15. If (Len(strSubject) > 0) Then .Subject = strSubject
  16. If (Len(strBody) > 0) Then .TextBody = strBody
  17. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  18. 'Name or IP of Remote SMTP Server
  19. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strMailServer
  20. 'Type of authentication, NONE, Basic (Base64 encoded), NTLM
  21. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/authenticate") = 0
  22. 'Your UserID on the SMTP server
  23. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strNTUserName
  24. 'Your password on the SMTP server
  25. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strNTUserPwd
  26. 'Server port (typically 25)
  27. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  28. 'Use SSL for the connection (False or True)
  29. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False
  30. 'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
  31. .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
  32. .Configuration.Fields.Update
  33. .Send
  34. End With
  35. ExitProcedure:
  36. Exit Function
  37. ErrHandler:
  38. Err.Raise Err.Number, "Mail_SMTP", "An the following error occurred while attempting " & _
  39. "to send mail via Mail_SMTP." & vbCrLf & "Error Number: " & Err.Number & _
  40. vbCrLf & vbCrLf & "Error Description: " & vbCrLf & Err.Description
  41. Resume ExitProcedure
  42. End Function
Thanks again!