Still having problems with CDO

S

SHIPP

I am using the following code....

Public Sub sSendEmail(ByVal strMailTo, _
ByVal strSubject, _
ByVal strMsg, _
ByVal strFromMail)

On Error GoTo HandleErr
Const cstrProcName As String = "frmEmail - sSendEmail"

Dim objMsg, strSMTP, blnReturn
Dim strPath As String
Dim strFile As String

blnReturn = False

Const cdoSendUsingPort = 2

strSMTP = "localhost"

Set objMsg = CreateObject("CDO.Message")

'Apply the settings to the message object
With objMsg

.From = strFromMail
.To = strMailTo
.BCC = "your email for testing"
.Subject = strSubject
.TextBody = strMsg


..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of remote SMTP server

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
'Server port

..Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Configuration.Fields.Update

On Error Resume Next

.Send

If Err.Number = 0 Then
blnReturn = True
End If
End With


ExitHere:
Set objMsg = Nothing
Exit Sub

HandleErr:
Select Case Err.Number
Case Else
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
cstrProcName
End Select
GoTo ExitHere

End Sub

I keep on getting the following error message....

"Your email message was unable to be sent because your mail server rejected
the message:
550 Invalid recipient: (e-mail address removed)"

This is my own email address. I do not understand what is going on. Any help
would be appreciated.
 
S

SHIPP

I'll give this a try when I get home. I hope it solves the problem. If not
could I email you?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top