501 Error When Setting Local Host? 
Author Message
 501 Error When Setting Local Host?

Hello all,

I'm relatively new to Winsock programming and am using the Winsock
tool that comes with VB6.  I'm trying to connect to our Exchange
server via SMTP to send an e-mail message from VB6.  The app is loaded
onto our Citrix server.  It works for me when I use the program from a
Citrix session.  It does not work for users in a remote site who are
logging into the same server.  The code looks like this:

    With mdiMain.winskSMTP
        .LocalPort = 0

        If .State <> sckClosed Then
            .Close
            DoEvents: DoEvents: DoEvents
        End If

        sStep = "SMTP Connection"
        .Protocol = sckTCPProtocol
        .RemoteHost = sMailServerName
        .RemotePort = 25
        .Connect
        If WaitForSMTP(220) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Send HELO"
        .SendData ("HELO " & sMailServerName & vbCrLf)
        If WaitForSMTP(250) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Send Mail From"
        .SendData (sMailFrom)
        If WaitForSMTP(250) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Send Mail To"
        .SendData (sMailTo)
        If WaitForSMTP(250) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Send Data Prep"
        .SendData ("data" & vbCrLf)
        If WaitForSMTP(354) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Send Data"
        .SendData (sMailData)
        .SendData ("." & vbCrLf)
        If WaitForSMTP(250) Then GoTo SendSMTPEmail_Error

        sStep = "SMTP Quit"
        .SendData ("quit" & vbCrLf)
        If WaitForSMTP(221) Then GoTo SendSMTPEmail_Error

        .Close
    End With

They receive error message "501 5.5.4 Invalid Address".  But they
receive it at the point in the code before sStep is set, which has to
be from the .LocalPort or .State commands. Can anyone help me figure
this one out?

Thanks in advance,
Robin



Sat, 18 Jun 2011 03:36:29 GMT  
 501 Error When Setting Local Host?

Quote:
> They receive error message "501 5.5.4 Invalid Address".  But they
> receive it at the point in the code before sStep is set, which has to
> be from the .LocalPort or .State commands. Can anyone help me figure
> this one out?

You are probably using a host name or email without validation, such as
empty string for email. You need to make a log of the last send operation.
Perhaps you can add "Show Status" button which expands the bottom area of
the form to see what is being sent and received in a locked TextBox, much
like the dialup adapter. The user can copy and send the result to you.

Also, why reinvent the wheel when you can download free SMTP components that
also support attachment if you need them in the future? Here is one method:

http://killervb.com/SendMailLib.aspx

If you search the web for "smtp.ocx", you will find some free ones.



Sat, 18 Jun 2011 04:44:57 GMT  
 501 Error When Setting Local Host?

Quote:
> ? ? ? ? .SendData ("HELO " & sMailServerName & vbCrLf)

What is the contents of 'sMailServerName'?

Quote:
> They receive error message "501 5.5.4 Invalid Address". ?But they
> receive it at the point in the code before sStep is set, which has to
> be from the .LocalPort or .State commands. Can anyone help me figure
> this one out?

Whatever is in 'sMailServerName' is being rejected by the mail server.
You are mis-diagnosing the problem. The 5.5.4 error can only occur in
response to a bad HELO or EHLO.

DS



Sat, 18 Jun 2011 09:43:06 GMT  
 501 Error When Setting Local Host?
Hi,

Thanks for the response.  I'm not using a user form to gather the
message and e-mail data.  Its all set programmatically and behind the
scenes without the user's intervention.  So I don't think its an empty
text box issue.

Haven't used the free SMTP stuff since they seem to be mostly in
VB.NET.  I'm using VB6.

I saw another post about my SMTP mail server name and will try
following up with that.

Again, thanks.

Robin


Quote:


> > They receive error message "501 5.5.4 Invalid Address". ?But they
> > receive it at the point in the code before sStep is set, which has to
> > be from the .LocalPort or .State commands. Can anyone help me figure
> > this one out?

> You are probably using a host name or email without validation, such as
> empty string for email. You need to make a log of the last send operation.
> Perhaps you can add "Show Status" button which expands the bottom area of
> the form to see what is being sent and received in a locked TextBox, much
> like the dialup adapter. The user can copy and send the result to you.

> Also, why reinvent the wheel when you can download freeSMTPcomponents that
> also support attachment if you need them in the future? Here is one method:

> http://killervb.com/SendMailLib.aspx

> If you search the web for "smtp.ocx", you will find some free ones.



Sat, 02 Jul 2011 06:11:11 GMT  
 501 Error When Setting Local Host?
Hello David,

sMailServerName is "MAIL.COMPANY.COM".  Its set by the subroutine that
calls the mail subroutine and passed in through the arguments.

I would have thought that the HELO would be tripping the error, but
the debug message that the program is passing me is very clearly
occurring before the HELO line can be called.  Is there a problem with
using the .CONNECT property after setting the .REMOTEHOST to a bad
name?

I'll talk to our IT group to see if the server name is bad from our
remote site.  It works great from this site.

Thanks for the help,
Robin


Quote:

> > ? ? ? ? .SendData ("HELO " & sMailServerName & vbCrLf)

> What is the contents of 'sMailServerName'?

> > They receive error message "501 5.5.4 Invalid Address". ?But they
> > receive it at the point in the code before sStep is set, which has to
> > be from the .LocalPort or .State commands. Can anyone help me figure
> > this one out?

> Whatever is in 'sMailServerName' is being rejected by the mail server.
> You are mis-diagnosing the problem. The 5.5.4 error can only occur in
> response to a bad HELO or EHLO.

> DS



Sat, 02 Jul 2011 06:17:46 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Error 501 - Not implemented or not supported Internet

2. !!!HTTP/1.0 501 Not Supported (using a form)

3. what is HTTP/1.0 501 ?

4. how to get local TCP/IP settings from Local Area Connections

5. Search local host name with API...

6. FileSystemObject Write to Local Drive from Remote Host?

7. shutting down, rebooting, power down local host???

8. Copy file from local machine to web host

9. Winsock Control SP2 - many IP Address on Local Host

10. Search local host name with API...

11. Search local host name with API...

12. On local error resume next Vs on error resuem next

 

 
Powered by phpBB® Forum Software