View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
mikems[_2_] mikems[_2_] is offline
external usenet poster
 
Posts: 1
Default Error in Sending Email via CDO


Hi,

I have tried two differents macro to send email via CDO in order not t
have the Outlook confirmation button, but I have an error while runnin
both here are the codes and error messages :

-Sub envoimail()

' Reference to Microsoft ActiveX Data Objects 2.5 Library
' Reference to Microsoft CDO for Windows 2000 Library
Dim iConf As New CDO.Configuration
Dim Flds As ADODB.Fields

Set Flds = iConf.Fields
Flds(cdoSendUsingMethod) = cdoSendUsingPort ' 2
Flds(cdoSMTPServer) = "mailvel.velizy.fr.sterianet"
Flds(cdoSMTPServerPort) = 25
Flds(cdoSMTPAccountName) = "mylogin"
Flds(cdoSMTPAuthenticate) = cdoBasic ' 1

Flds(cdoSendUserName) = "mylogin"
Flds(CdoSendPassword) = "mypassword"

Flds(cdoSendEmailAddress) = """Michaël Sochon"
"
Flds(cdoSMTPUseSSL) = True
Flds.Update

Dim iMsg As New CDO.Message
Set iMsg.Configuration = iConf

With iMsg
.To = "
.CC = "
.BCC = ""
.From = """Michaël Sochon"" "
.Subject = "This is a test"
.TextBody = "This is the body text"
.AddAttachment "D:\Mes documents\Steria\Manpower\Stat
réléphonie\suivi_global.xls "
End With
iMsg.Send

Set iMsg = Nothing
Set iConf = Nothing

End Sub-

There the error message is : Transport failed while connecting t
server.

the other macro is :

-Sub envoimailbis()
Dim iMsg As Object
Dim iConf As Object


Application.ScreenUpdating = False

Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")


With iMsg
Set .Configuration = iConf
.To = "
.CC = "
.BCC = ""
.From = """Michaël Sochon"" "
.Subject = "This is a test"
.TextBody = "This is the body text"
.AddAttachment "D:\Mes documents\Steria\Manpower\Stat
réléphonie\suivi_global.xls "
.Send
End With

Set iMsg = Nothing
Set iConf = Nothing
Set wb = Nothing
Application.ScreenUpdating = True

End Sub-

And the error msg is : Configuration value "sendusing" is invalid


Can anyone help about this...

--
mikem
-----------------------------------------------------------------------
mikems's Profile: http://www.excelforum.com/member.php...fo&userid=1522
View this thread: http://www.excelforum.com/showthread.php?threadid=26850