| Author |  | 
      
        | stevewhite Newbie
 
  
 
 Joined: 28 May 2008
 Location: United States
 Online Status: Offline
 Posts: 6
 | 
          I am running into a problem when sending to multiple domains and a prior domain is TLS.  As a background this is what I am doing.
           | Posted: 28 May 2008 at 7:04am | IP Logged |   |  
           | 
 |  
 I am sending a message to one domain at a time, as I need to direct send.  If the domain I send to first is TLS then I go throught the TLS process.  I then, using the same smtp object, resetmessage, clear DnsServers and SmtpServers then call DnsServers.AutoDetect.
 
 When sending to the second domain it gives me a "At least one SMTP server must be specified in order to send to relay server." exception.
 
 Is there a property I have to reset that I am missing.
 
 If I flip the order of the recipients and send to the non tls domain first, everything works fine.
 
 Thanks,
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Could you provide us with a simple and self-contained example which would allow us to immediately run it and reproduce the problem?
           | Posted: 28 May 2008 at 7:26am | IP Logged |   |  
           | 
 |  
 You can send it through our Request Support Form (assuming it may contain private information like real e-mail addresses).
 
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | stevewhite Newbie
 
  
 
 Joined: 28 May 2008
 Location: United States
 Online Status: Offline
 Posts: 6
 | 
          Alex,
           | Posted: 29 May 2008 at 6:41am | IP Logged |   |  
           | 
 |  I have sent a sample via the support form.
 
 Thanks,
 Steve
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          The sample recived, thank you. We'll contacxt you via e-mail shortly.
           | Posted: 29 May 2008 at 7:06am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Alex AfterLogic Support
 
  
  
 Joined: 19 November 2003
 Online Status: Offline
 Posts: 2207
 | 
          Adding Smtp.ResetState() prior to calling Smtp.Send() second time eliminated the issue.
           | Posted: 29 May 2008 at 7:21am | IP Logged |   |  
           | 
 |  
 Regards,
 Alex
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | stevewhite Newbie
 
  
 
 Joined: 28 May 2008
 Location: United States
 Online Status: Offline
 Posts: 6
 | 
          Alex,
           | Posted: 25 June 2008 at 2:09pm | IP Logged |   |  
           | 
 |  That worked great, however I now have a new problem.
 
 I need to work more within the confines of MailBee.  That is to say, rather than looping through each domain, I would rather take advantage of MailBee as the relay server. However, a new problem with Tls is rearing it's head.
 
 How can I send to multiple domains, through one call to Send, and make sure that one or more of the domain's messages are delivered with Tls enabled?
 
 Any help would be much appreciated.
 
 Thanks
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          If your application sends messages directly to recipients SMTP servers, it acts as an MX server. MX servers never use SSL/TLS for sending messages, moreover, they always connect/listen to port 25. Secure connections can be established between a relay SMTP server and a client e-mail software only.
           | Posted: 26 June 2008 at 12:29am | IP Logged |   |  
           | 
 |  
 Best regards,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | stevewhite Newbie
 
  
 
 Joined: 28 May 2008
 Location: United States
 Online Status: Offline
 Posts: 6
 | 
          Another follow up question.
           | Posted: 26 June 2008 at 7:04am | IP Logged |   |  
           | 
 |  
 I understand that using DnsServers.Autodetect is going to send through port 25 without Tls.
 
 I still need to be able to send to multiple domains, some with Tls, some without, without losing the distribution list.  I know I can strip out the email addresses for the other domains and call send for each domain, but then I lose the distribution list in the header.
 
 I have tried to manually add the To header for the other recipients, via Message.Header.Add, not for that domain, but it seems to override the Message.To collection.
 
 Problem is that specific clients expect Tls delivery and others don't.
 
 If I loop through the domains without modifying the distribution list, I end up with multiple messages delivered to each recipient.
 
 
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | stevewhite Newbie
 
  
 
 Joined: 28 May 2008
 Location: United States
 Online Status: Offline
 Posts: 6
 | 
          I think that we have figured this one out.
           | Posted: 26 June 2008 at 8:02am | IP Logged |   |  
           | 
 |  
 I was modifying the header in the wrong place, before the call to Send.  I added an EventHandler on SendingMessage that replaces the To and Cc headers with the full distribution list.
 
 This is done here, after the call to GetAllRecipients.
 
 If you see any issue with this please let me know.
 
 Thanks,
 Steve
 | 
       
        | Back to Top |     | 
       
       
        |  | 
        | Andrew AfterLogic Support
 
  
 
 Joined: 28 April 2006
 Location: United States
 Online Status: Offline
 Posts: 1189
 | 
          If we understood you correctly, you need to send messages to an address list different from what's specified in To/Cc/Bcc headers. This can be easily done via this or this overload of Smtp.Send method. The second parameter accepts recipients list the message will be actually sent to.
           | Posted: 27 June 2008 at 12:14am | IP Logged |   |  
           | 
 |  
 Best regards,
 Andrew
 | 
       
        | Back to Top |     | 
       
       
        |  |