473,395 Members | 1,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Help with sending Email using CDO: Server rejected sender address

I tried writing a macro in sending out email using CDO via Excel VBA. I am getting the below error:
"The server rejected the sender address. The server response was 530 5.7.1. Client was not authenticated."

Below is my code:

Expand|Select|Wrap|Line Numbers
  1. Function SendHTMLMail()
  2.  
  3. Dim iCfg As Object 
  4. Dim iMsg As Object ' 
  5.  
  6. Set iMsg = CreateObject("CDO.Message")
  7. Set iCfg = CreateObject("CDO.Configuration")
  8.  
  9.  iCfg.Load -1    ' CDO Source Defaults
  10.         Set Flds = iCfg.Fields
  11.         With Flds
  12.             .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
  13.             .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
  14.                            = "smtp.xxx.com" 'i did put in the correct smtp and connected without issue.
  15.             .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
  16.             .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
  17.             .Update
  18.         End With
  19.  
  20. With iMsg
  21. Set .Configuration = iCfg
  22. .From = "richard@test.com"
  23. .Sender = "richard@test.com"
  24. .Subject = "Testing Email"
  25. .HTMLBody = Test Email"
  26. .To = "rob@test.com"
  27. .Send
  28. End With
  29.  
  30. Set iMsg = Nothing
  31. Set iCfg = Nothing
  32.  
  33. End Function
Jan 16 '13 #1
3 11778
Rabbit
12,516 Expert Mod 8TB
I don't use cdo much but the error sounds like you need to authenticate with the server before trying to send the e-mail.
Jan 16 '13 #2
I've tried putting the username and password, but i'm getting the same result
Expand|Select|Wrap|Line Numbers
  1. .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "richard@test.com"
  2. .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "xxxxxx"
Jan 17 '13 #3
NeoPa
32,556 Expert Mod 16PB
Is there a {Sender Address} (or similar) property within iCfg.Fields? That's what the error message seems to be complaining about. Is "richard@test.com" (.Sender from line #23) a valid and recognised address?

NB. Please remember to use the CODE tags when posting code. Your posts have been fixed twice for you already.
Jan 17 '13 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brent Burkart | last post by:
Is there any difference in sending an email through asp.net using Exchange Server rather than the normal way? Any help is appreciated. Brent
1
by: dave | last post by:
Hi There I have got little bit asp code to send email It was working if its hosted on windows 2000.. But it doesnt work on winows server 2003..I guess it might be problem with specifying...
6
by: Boris | last post by:
I asked how to send an email using CDO instead of CDONTS and got several responses. They were all good, I tested the code and it works well. However, I forgot to mention that I need to set the email...
4
by: Kurien Baker Fenn | last post by:
I am using CDONTS to send a mail.There is no error in the code and it says that the mail has been send successfully,But i am not receiving any mails.please help. The Code Set vobjMail =...
5
by: vagzone | last post by:
I used the following code sending email on the server. I got no error messages but I never received any email.. System.Web.Mail.SmtpMail.Send("someone@some.com","me@some.com", "test", "test") ...
6
by: Robert Pettersson | last post by:
Hi, I have built an webapp in C# that uses SMTPMail to send mail to users. When I installed it on the prodserver everything worked fine for me, but the users can not send mail. They get Access...
6
by: lalit26011983 | last post by:
Can any1 help me... How to send emails using asp.net.. I m using windows 2000 server and visual studio 2003(.net framework 1.1) I m not getting any error while i m sending email using...
0
by: Sister Ray | last post by:
I'm trying to create a simple form that sends an email using my company's exchange server. I'm using the System.Net.Mail Namespace of the .net framework 2.0. I've googled everywhere and i think my...
6
by: evenlater | last post by:
I'm trying to send an email from an Access procedure using CDO. I've been able to do it successfully with three different sending email addresses, but not with the email address I actually need to...
0
by: trivedimca2005 | last post by:
I am using below code for sending Email using .net. Its not working on client machine. My server IP is:- 192.168.10.10 and also uses proxy and user-name and password for proxy settings are...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.