Coding.NET CDO e-mailing horrors

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ally  
 To:  ALL
35664.1 
Some people I'm doing contract work for have provided me with the following as an e-mail script that works for them:

VB.NET code:
 Public Sub SendMail(ByVal recip As String, ByVal sender As String, ByVal theMessage As String, ByVal theSubject As String, Optional ByVal carbonCopy As String = "", Optional ByVal blindCarbonCopy As String = "")
 
    Const cdoSendUsingPickup = 1
 
    Dim iMsg, iConf, Flds
 
    iMsg = CreateObject("CDO.Message")
    iConf = CreateObject("CDO.Configuration")
 
    Flds = iConf.Fields
    With Flds
      .Item(" http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup
      .Update()
    End With
    With iMsg
      .Configuration = iConf
      .To = recip
      .Cc = carbonCopy
      .Bcc = blindCarbonCopy
      .From = sender
      .Subject = theSubject
      .TextBody = theMessage
      .Send()
    End With
 
    iMsg = Nothing
    iConf = Nothing
    Flds = Nothing
 
 
  End Sub
 


I'm sure it'll work if I convert it to C# and add a CDO reference and all that jazz, but System.Net.Mail is there for a bloody reason.

Problem is, I don't know what the server address is. CDO clearly doesn't need one- is there any way I can get Net.Mail to do the same?
0/0
 Reply   Quote More 

 From:  THERE IS NO GOD BUT (RENDLE)  
 To:  Ally     
35664.2 In reply to 35664.1 
At a guess, that's just defaulting to localhost on port 25, so try those as parameters to the SmtpClient constructor.

0/0
 Reply   Quote More 

 From:  Ally  
 To:  THERE IS NO GOD BUT (RENDLE)     
35664.3 In reply to 35664.2 
Already tried that. Very odd. However, time is pressing so I think I'm just to go with CDO. Sigh.
0/0
 Reply   Quote More 

Reply to All    
 

1–3

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats