The message could not be sent to the SMTP server.

  • 18 September 2008
  • 2 replies
  • 3 views

Badge +1

Hi


I get this error when sending emails using my code modules in K2.


I have set the default smtp server name in the K2Server.config file to the name of our exchange server. 


full error msg "System.Runtime.InteropServices.COMException (0x80040211): The message could not be sent to the SMTP server. The transport error code was 0x800ccc15. The server response was not available"


This is the function i'm using;


 Private Function sendServerMail(ByVal K2 As ServerEventContext, _
  ByVal fromAddress As String, _
  ByVal toAddress As String, _
  ByVal Subject As String, _
  ByVal Body As String)
  'send the mail       
  Dim objMsg As New System.Web.Mail.MailMessage()
  Dim objAttachment As System.Web.Mail.MailAttachment
  Dim objSender As System.Web.Mail.SmtpMail
  objSender.SmtpServer = SourceCode.K2Utilities.GeneralMod.GetDefaultSMTPServer()
 
  objMsg.From = fromAddress
  objMsg.To = toAddress
  objMsg.Subject = Subject
  objMsg.Body = Body
  objSender.Send(objMsg)


 End Function


Any ideas 



 


2 replies

Badge +9

I've heard of this happening before if the K2 server is not able to reach the SMTP server.  I'd check:

1. Is the default SMTP server settings are correct?

2. Can you ping the SMTP server from the K2 server?

3. Can you telnet to the SMTP server from the K2 server?


Badge +13

Change to use 2.0's SMTP class.

Dim objMsg As New System.Net.Mail.MailMessage
Dim objSender As New System.Net.Mail.SmtpClient

objSender.Host = SourceCode.K2Utilities.GeneralMod.GetDefaultSMTPServer()

objMsg.From = New System.Net.Mail.MailAddress(K2.StringTable("WorkflowAdmin"))
objMsg.To.Add(strToRecipient)
        If strCCRecipient.Length > 0 Then
            objMsg.CC.Add(strCCRecipient)
        End If
        objMsg.Subject = strSubject
        objMsg.Body = strBody
        objSender.UseDefaultCredentials = True   'This allows authentication
        objSender.Send(objMsg)

Reply