jwcolby
jwcolby at colbyconsulting.com
Fri May 23 20:41:33 CDT 2008
S Lee, Thanks for the response. It looks like you responded directly to me rather than to the AccessD group. I am CCing the group so that everyone can be involved in the discussion. The "box" I am running this code on is my laptop in this case, however I need a generic solution, not one that only works in one specific place or on one specific machine. I have a home office, with a bunch of machines in a workgroup. I do not run a mail server here in my office. All of the email for my company is handled by servers "out there" somewhere. I have a web hosting company which hosts my web as well as handles my email. As I mentioned, I actually use a mail forwarder www.no-ip.com due to the fact that so many ISPs block port 25 and force you to send email through their servers. I understand that they do this to (try to) control spam, and it works fine for a computer in a fixed location, however it breaks things when you use a laptop and travel. In any event, I do need "working code" however I also need "working knowledge" so that I understand the code. There is nothing worse in my humble opinion than using code that you don't understand. TIA for any help you can give. John W. Colby www.ColbyConsulting.com S Lee (Career Svcs.) wrote: > what box are you running this code on? if it is a web server, the > email account you are sending from must exist on it. otherwise, your > first function looks fine. I don't use the schema that you show in your > second example. > > I send emails all the time through web servers that I have access to, > using asp. I can send you examples of those if you like. > > > > -----Original Message----- > From: accessd-bounces at databaseadvisors.com > [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Friday, May 23, 2008 4:04 PM > To: Access Developers discussion and problem solving; VBA > Subject: [AccessD] CDO Email > > Folks, > > I was recently dernaged enough to stop using outlook (which > worked just fine, but was a ROYAL PITA to move from computer > to computer) and start using Thunderbird. > > Now... > > I need to use CDO to send my mail (I guess). I have a bit > of an issue in that I use an SMTP "mail forwarder" to send > my email, to get around port 25 blocking. > > I have found three different pieces of code, none of which > "just work", in fact none of them work at all. > > Function mCDOSendMail() > Dim objMessage As CDO.Message > Set objMessage = CreateObject("CDO.Message") > objMessage.Subject = "Example CDO Message" > objMessage.From = "jwcolby at colbyconsulting.com" > objMessage.To = "jwcolby at colbyconsulting.com" > objMessage.TextBody = "This is some sample message text." > objMessage.Send > End Function > > the above code gives me an error "The send using > configuration is invalid". > > > Sub CDO_Mail_Small_Text() > Dim iMsg As Object > Dim iConf As Object > Dim strbody As String > > > > Set iMsg = CreateObject("CDO.Message") > Set iConf = CreateObject("CDO.Configuration") > > iConf.Load -1 ' CDO Source Defaults > Dim Flds As Variant > Set Flds = iConf.Fields > With Flds > > .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") > = 2 > > .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") > _ > = "smtp-auth.no-ip.com" > > .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") > = 3325 > .Update > End With > > strbody = "Hi there" > With iMsg > Set .Configuration = iConf > .To = "jwcolby at colbyconsulting.com" > .CC = "" > .BCC = "" > .From = """John"" <jwcolby at colbyconsulting.com>" > .Subject = "Important message" > .TextBody = strbody > .Send > End With > End Sub > > The above code gives me: > > "The server rejected one or more recipient addresses. The > server response was 554 5.7.1 <unknown[97.82.150.214]>: > client host rejected: Access denied" > > This looks like SOMETHING is happening. smtp-auth.no-ip.com > is MY email forwarder. > > The problem here is that all of these examples give NO > explanation of anything that is happening. Like what in the > heck is all the HTTP://schemas crap? Why is it going to > microsoft.com? Am I supposed to change that? If so to what? > > Wouldn't it be nice if just ONE TIME example code would > actually tell you what you need to know to use it? > > Can anyone help me with this stuff? > > Thanks, >