linder76
asked on
Sending email via VBA code
I am writing a error routine for a program. My client wants me to write where if the program errors during its run that the error is sent to her cell phone (text message) or email account. Is there a way to do this?
Thank you,
Joe
Thank you,
Joe
ASKER
Thanks, but what is the objects I need to use?
By far the simplest is SendObject
if u use this, then credit goes to Carl
this is an example of using it
DoCmd.SendObject , , , "fred@smith.com", , , "My Subject", "My Message - Oh Dear"
There are alternative methods also
Do note, if u have the later versions of Outlook, then u may well get a security message coming up
If u do then look at the answer I gave to, of all people, Carl! https://www.experts-exchange.com/questions/21904604/Auto-Email-Query-from-Access.html
Note, if u use SendObject, credit goes to Carl, not me
if u use this, then credit goes to Carl
this is an example of using it
DoCmd.SendObject , , , "fred@smith.com", , , "My Subject", "My Message - Oh Dear"
There are alternative methods also
Do note, if u have the later versions of Outlook, then u may well get a security message coming up
If u do then look at the answer I gave to, of all people, Carl! https://www.experts-exchange.com/questions/21904604/Auto-Email-Query-from-Access.html
Note, if u use SendObject, credit goes to Carl, not me
ASKER
This needs to work without Outlook. It needs to send the message via the code with out user intervention. Is that possible?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you not use outlook as your email system then?
Carl, who was that question to?
if to me, well then, CDO uses Exchange directly, but I use both Outlook and CDO. I prefer CDO if and when I know the SMTP server, otherwise stick to SendObject or Outlook Auto
I prefer CDO only because of the security check it bypasses
if to me, well then, CDO uses Exchange directly, but I use both Outlook and CDO. I prefer CDO if and when I know the SMTP server, otherwise stick to SendObject or Outlook Auto
I prefer CDO only because of the security check it bypasses
It was to linder76 rocki, but I understand completely why you prefer CDO if it bypasses security after my problem a few days ago
ASKER
Correct I donot want to use Outlook. This needs to be an automated event.. I am reviewing the comments, what does s/w stand for?
Joe
Joe
s/w = software :-)
ASKER
I have copy and pasted the code. however the web address when I click on them don't work...also I erase them in the code. Should I be doing that?
ASKER
I am still haveing problems. I have my reference book with me. What does CDO stand for. I am not familar with it.
ASKER
I keep getting the following error...
Error in sending. The message could not be sent to the smtp server.
The transport error code was 0x80040217. The server response was not available.
Help????
Error in sending. The message could not be sent to the smtp server.
The transport error code was 0x80040217. The server response was not available.
Help????
ASKER
Thanks for your help! I finally found what I was doing wrong. I needed to add script lines for my account name and password
Joe
Joe
CDO = Collaboration Data Objects
its a MS thing
Remember to specify the FROM and SMTP Server also
its a MS thing
Remember to specify the FROM and SMTP Server also
try:
DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]
Carl.