Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ways to test SendMail function? 1

Status
Not open for further replies.
Joined
Mar 14, 2002
Messages
711
Location
US
I have a form that runs a line of code, including a query from Access, and then sends the results via VB Sendmail function, but for some reason, does nothing happen when I run the code, it runs without errors, but no email is sent. I was wondering how I can test to make sure my VBSendmail parameters are correct before I start to disect the code?

Thanks!
 
Add some messages between the lines to see if something happens.
 
This is what I have, if it worked, then I should receive at least a blank message with the subject line, correct?

poSendMail.SMTPHost = "hostname"
poSendMail.From = "Document_Control@site.com"
poSendMail.FromDisplayName = "Corrective Action Reminder-Document Control"
poSendMail.Recipient = "sandbergns@site.com"
poSendMail.RecipientDisplayName = strName
If Not IsNull(strCCrecipient) Then
poSendMail.CcRecipient = strCCrecipient & "@site.com"
Else
poSendMail.CcRecipient = ""
End If
poSendMail.ReplyToAddress = ""
poSendMail.Subject = "Corrective Actions Needing your Attention"
poSendMail.Message = "The following Corrective Action" & IIf(intCAR = 1, " needs", "s need") & " your immediate attention: " & strCAR & "." & _
vbCrLf & vbCrLf & " Please go to <<file:\\Quality System Database.mdb>> to complete this task." & vbCrLf & vbCrLf & "Thanks You"
poSendMail.Send
if rsCavities.EOF = True Then
Exit Do
End If
Loop
 
The VBSendMail component includes an event mechanism to get step-by-step event reporting as I recall. You could use that to see where the problem occurs. If you are on a corporate network I suggest you look at your anti-virus settings to see if they are blocking SMTP transactions from workstations.
 
Thanks avanderlaan, I will check both and let you know,
 
It was my firewall installed on my client that blocked me, thanks, I should have thought of that :-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top