Developer forum

Forum » Development » No valid SMTP host found. Please specify a valid SMTP host in Control Panel

No valid SMTP host found. Please specify a valid SMTP host in Control Panel

Dimitrij Jazel
Reply

Hi guys,

I am getting this error here:

https://www.screencast.com/t/o8LKl0ZSkT

 

It is pretty obvious what is the issue - SMTP settings.

 

But the problem is that they are correct.

+ on the same IIS server, thre is another same copy application, that uses exactly same settings, and does exactly the same, but solution works.

I think it could be usefull to see the setting that system is unable to reach.

Like instead of saying that it can't reach the server - maybe it could include what server it was trying to reach.

 

Normally SMTP settings are located oin MC>System.

Unless there os other SMTP settings system might want to use ( when using Extranet remind me password feature).

I would like to know about those, but I don't think there are any.

 

Network guys saying it is all ok.

On same machine, there is site, that this copy was taken from. and it works there.

 

What can be the issue?

 

/Dmitrij

 

 


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Dump us your settings.

The issue is wrong smtp settings or something that prevents the SMTP to work.

This is the code generating the exception:

Dim hostString As String = Base.ChkString(Base.GetGs("/Globalsettings/System/MailServer/Server"))
                        If String.IsNullOrEmpty(hostString) Then
                            hostString = "smtp.dynamic-systems.lan"
                        End If
                        If Not String.IsNullOrEmpty(hostString) Then
                            Dim hostList As New Generic.List(Of String)
                            If hostString.Contains(";"c) Then
                                hostList.AddRange(hostString.Split(";"c))
                            ElseIf hostString.Contains(","c) Then
                                hostList.AddRange(hostString.Split(","c))
                            Else
                                hostList.Add(hostString)
                            End If

                            Dim sendUsingHost As Boolean = False
                            For Each host As String In hostList
                                Try
                                    sender.Host = host.Trim
                                    sender.Send(mailMessage)
                                    sendUsingHost = True
                                    Exit For
                                Catch ex As Exception
                                    sendUsingHost = False
                                End Try
                            Next

                            'No valid host found, so throw exception
                            If Not sendUsingHost Then
                                Throw New Exception("No valid SMTP host found. Please specify a valid SMTP host in Control Panel.")
                            End If
                        Else
                            Log("Unable to send mail. Control panel setting for Mailserver is missing.", isFirstError)
                            isFirstError = False
                        End If

Votes for this answer: 1

 

You must be logged in to post in the forum