[AccessD] Email problem. Again

Stuart McLachlan stuart at lexacorp.com.pg
Tue Mar 2 16:01:55 CST 2010


What SMTP server are you sending this through? Do you know anything about the way it is 
configured?

Generally an SMTP server will be set up with various "relay" controls.  These will be a 
combination of any of the following:

1. Acccept email for specified (local) domains  from anyoine.
2. Accept email for  delivery to anyone from specified (local) IP addresses
3. Accept email for delivery to anyone if the request comes from an IP address which has just 
( withint x minutes?)  made a POP3 connection using a vaild login name/password
4. Accept email for delvery to anyone as long as they use SMTP Authentication methods.

In your case the server is saying that it is rejecting the To address  because the domain of 
the recipient isn't local and is not in a specified list of external domains.   This may be 
because and absolute restriction or it may be because it operates on a combination of rules 1 
and 4 above. 

If it is an AUTH problem, it gets quite tricky.

There are several types of Authentication, AUTH-LOGIN, AUTH-PLAIN and AUTH-CRAM5
The server may support, one, tow or all three of these methods, the only way to find out is to 
look at the response the server gives to a EHLO command.

Each of these methods requires a different set of commands/parameters.  This is further 
complicated by the fact that the server may require a TSL/SSL  encryted connection.


To put it simply,  processes such as the Class under discussion are fine for communicating 
with a local (on the same internal network) SMTP server but don't have the necessary "grunt" 
to handle the far more complicated processes involved in working with external servers which 
have anti-relaying restrictions in place.  If an external server doesn't have anti-relay 
restrictions in place, the spammers will find it very quickly and flood it with delivery requests,




On 2 Mar 2010 at 12:16, Rocky Smolin wrote:

> Apparently I need to "authenticate my outgoing server"  whatever the hell
> that means.  
> 
> Rocky
>  
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
> Sent: Tuesday, March 02, 2010 11:42 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Well - that's out of scope for me.  But I bet someone else on this list
> knows exactly what it means.
> 
> I would try copying that complete error message into a google/bing search
> field and see what comes up.
> 
> Good to see that the vbSendMail code actually told you what's wrong.
> 
> Dan
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Tuesday, March 02, 2010 12:47 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Dan:
> 
> 533 Sorry, that domain isn't in my list of allowed rcpthosts is the message
> I get.
> 
> 
> What it means?
> 
> Rocky
>  
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
> Sent: Tuesday, March 02, 2010 10:36 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Hi Rocky,
> 
> This is a class so it's done a little differently.
> 
> The class name is 'EmailSMTP', and we've set up a public variable to
> represent that class - 'ES'.
> 
> So you can call a procedure in that class like this:
> 
> Call ES.SendEmailsNowSMTP(Me.txtSMTPMailServer, _
>     Me.txtSMTPUserName, _
>     Me.txtSMTPUserName, _
>     Me.txtTestSubject, _
>     Me.txtTestTo, _
>     Me.txtTestTo, , Me.txtTestMessage, Me.txtTestAttachment)
> 
> And I think that should do it.
> 
> 
> But there's one more thing - change this procedure as shown here:  
> (This was code for my error trapping framework.)
> 
> -------------------------------------------------------
> Private Sub poSendMail_SendFailed(Explanation As String)
> 
> DELETE THIS PERMANENTLY:
>     '-- The SMTPEmailFailed procedure is called so that ErrEx will record
> the Call Stack and also the value of Explanation
>     Call Run("SMTPErrorRaise", 600, "poSendMail_SendFailed", Explanation)
> 
> ADD THIS FOR TESTING:
>     MsgBox Explanation
> 
> End Sub
> -------------------------------------------------------
> 
> I'll be interested to hear what the problem was that you're having!
> 
> Dan
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Tuesday, March 02, 2010 11:31 AM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Dan:
> 
> I put your stuff right into the existing app (plan for success). I put your
> code into a class module named EmailSMTP and Public ES As New EmailSMTP into
> the module with all the PUBLICs.  And the app does compile. 
> 
> Now, I'm trying to call the Send Email sub with 
> 
> Dim varReturn As Variant
> 
> varReturn = SendEmailsNowSMTP(Me.txtSMTPMailServer, _
>     Me.txtSMTPUserName, _
>     Me.txtSMTPUserName, _
>     Me.txtTestSubject, _
>     Me.txtTestTo, _
>     Me.txtTestTo, , Me.txtTestMessage, Me.txtTestAttachment)
> 
> But I get a Sub or Function not defined with SendEmailsNowSMTP highlighted.
> 
> What am I doing wrong?
> 
> TIA
> 
> Rocky
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
> Sent: Monday, March 01, 2010 5:38 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Hi Rocky,
> 
> Sorry - badly worded advice!
> 
> What I'd suggest to start with is to get this working in a new mdb.  Then
> when you know it will work, just move the class module and standard module
> over to your mdb.  Of course for the standard module you could just put 
>    
>     Public ES As New EmailSMTP
> 
> in any standard module.
> 
> Because you're setting poSendMail as an object using WithEvents, you must
> reference the vbSendMail.dll, which typically you would place in the
> System32 folder.  
> 
> Hope that's better,
> Dan
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Rocky Smolin
> Sent: Monday, March 01, 2010 4:51 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Dan:
> 
> If I put that into a class module in a new mdb, how will the app that needs
> to send the email 'see' the class module?
> 
> "Now put this into a standard module:"  in the new mdb, yes?
> 
> Does this have to go into a new mdb or can I put it into the application
> that I'm trying to fix?
> 
> TIA,
> 
> Rocky
>  
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
> Sent: Monday, March 01, 2010 1:35 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] Email problem. Again
> 
> Rocky,
> 
> Open a new mdb and put this into a class module named 'EmailSMTP':
> ----------------------------------------------------------
> ' C Copyright ProMation Systems, Inc.
> ' Module    : EmailSMTP
> ' Author    : Dan Waters
> 
> Option Compare Database
> Option Explicit
> 
> Private WithEvents poSendMail As vbSendMail.clsSendMail
> 
> Private Sub poSendMail_SendFailed(Explanation As String)
> 
>     '-- The SMTPEmailFailed procedure is called so that ErrEx will record
> the Call Stack and also the value of Explanation
>     Call Run("SMTPErrorRaise", 600, "poSendMail_SendFailed", Explanation)
> 
> End Sub
> 
> 'Private Sub poSendMail_Progress(PercentComplete As Long) '
> '    Debug.Print "poSendMail_Progress " & PercentComplete
> '
> '    Exit Sub
> '    ErrEx.Bookmark = BOOKMARK_ONERROR
> '
> 'End Sub
> 
> 'Private Sub poSendMail_SendSuccesful()
> '
> '    Debug.Print "poSendMail_SendSuccesful "
> '
> '    Exit Sub
> '    ErrEx.Bookmark = BOOKMARK_ONERROR
> '
> 'End Sub
> 
> 'Private Sub poSendMail_Status(Status As String) '
> '    Debug.Print "poSendMail_Status " & Status
> '
> '    Exit Sub
> '    ErrEx.Bookmark = BOOKMARK_ONERROR
> '
> 'End Sub
> 
> Public Sub SendEmailsNowSMTP(stgSMTPHost As String, _
>     stgSMTPFromDisplayName As String, _
>     stgSMTPFromAddress As String, _
>     stgSMTPSubject As String, _
>     stgSMTPRecipientDisplayName As String, _
>     stgSMTPRecipientAddress As String, _
>     Optional blnSMTPAsHTML As Boolean, _
>     Optional stgSMTPMessage As String, _
>     Optional stgSMTPAttachmentList As String, _
>     Optional stgSMTPReplyToAddress)
>     
>     If stgSMTPRecipientDisplayName = "" Or stgSMTPRecipientAddress = "" Or
> stgSMTPRecipientAddress = "No Email Address" Then
>         Call Run("SMTPErrorRaise", 601, "SendEmailsNowSMTP", "Cannot Send
> Email")
>         Exit Sub
>     End If
>     
>     Set poSendMail = New vbSendMail.clsSendMail
> 
> '    -- Set up email paramaters
>     poSendMail.SMTPHost = stgSMTPHost
>     poSendMail.RecipientDisplayName = stgSMTPRecipientDisplayName
>     poSendMail.Recipient = stgSMTPRecipientAddress
>     poSendMail.FromDisplayName = stgSMTPFromDisplayName
>     poSendMail.from = stgSMTPFromAddress
>     poSendMail.Subject = stgSMTPSubject
>     
>     If Not IsMissing(blnSMTPAsHTML) Then
>         poSendMail.AsHTML = blnSMTPAsHTML
>     End If
>     If Not IsMissing(stgSMTPMessage) Then
>         If stgSMTPMessage <> "" Then
>             poSendMail.message = stgSMTPMessage
>         End If
>     End If
>     If Not IsMissing(stgSMTPAttachmentList) Then
>         If stgSMTPAttachmentList <> "" Then
>             poSendMail.Attachment = stgSMTPAttachmentList
>         End If
>     End If
>     If Not IsMissing(stgSMTPReplyToAddress) Then
>         If stgSMTPReplyToAddress <> "" Then
>             poSendMail.ReplyToAddress = stgSMTPReplyToAddress
>         End If
>     End If
> 
>     '-- When email is originated from the developer's PC, don't actually
> send email
>     If Environ("ComputerName") <> "DanWaters" Then
>         poSendMail.Connect
>         DoEvents
>         poSendMail.Send
>         DoEvents
>         poSendMail.Disconnect
>         DoEvents
>     End If
>     
>     Set poSendMail = Nothing
> 
> End Sub
> ----------------------------------------------------------
> 
>  
>  
> Now put this into a standard module:
> ----------------------------------------------------------
> Option Compare Database
> Option Explicit
> 
> Public ES As New EmailSMTP
> ----------------------------------------------------------
> 
> A nice feature of vbSendMail is that it will give you a report of when and
> why an SMTP email failed.  But you need to use 'WithEvents' in a class
> module for this to work.
> 
> You must register both the vbSendMail.dll file and the mswinsck.ocx file.
> 
> If you comment out the .SMTPHost line, vbSendMail will try to find the host
> name.  That's OK if there's only one.  But if there's more than one and you
> want to use a specific host, then you need that host name.
> 
> The instruction manual for vbSendMail is really good.
> 
> The only significant thing I see different is that I use the
> poSendMail.Connect and .Disconnect commands.  Can't remember if those are
> necessary or not.
> 
> Good Luck!
> Dan
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
> 
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com





More information about the AccessD mailing list