tags:

views:

17

answers:

0

Getting the following error message when web app attempts to send email from dev machine: WIN7 VS2010 .NET 4.0.

[SmtpException: Command parameter not implemented. The server response was: : Helo command rejected: need fully-qualified hostname]

Code executing is:-

    '###########################
    '# Divert to C.S. if on Test
    '# and set SMTP settings if
    '# on Dev machine
    '###########################
    Dim smtp As New SmtpClient()
    If GetResources.GetConnectionString.liveTest = "Test" Then
        toAddress = "[email protected]"
        subject += " - Test Site"

        smtp.Host = "mail.mydomain.net"
        smtp.Port = 25
        smtp.Credentials = New System.Net.NetworkCredential("[email protected]","xxxxxx")
    Else
        smtp.Host = "localhost"
        toAddress = toEmail
        CCAddress = CcEmail
    End If

    '############
    '# Send Email
    '############


    Dim fromAddress = New MailAddress(fromEmail,fromName)
    Dim message As New MailMessage()

    message.From = fromAddress
    message.To.Add(toAddress)
        If CcEmail <> "" AND CCAddress <> "" Then
            message.CC.Add(CCAddress)
        End If
    message.Subject = subject
    message.Body = body     
    If textMode = "HTML" Then
        message.IsBodyHtml = True
    End If


    Try
        smtp.Send(message)
        Return True
    Catch ex As ApplicationException
        'Report Error
        Return False
    End Try

I've modified the code because I've just moved from using W2K Server to Win7 as my dev machine and of course, Win7 doesn't have an SMTP capability in it's IIS!

Any help would be appreciated.