Connecting Tech Pros Worldwide Forums | Help | Site Map

Can Access autosend email through SMTP (w/o download) or through squirrelmail?

Newbie
 
Join Date: Mar 2007
Posts: 1
#1: Mar 22 '07
Hey everybody,
I'm developing a database in Access 2002 for my school's journal to track incoming articles as they make their way through publication. Only 1 editor is reading an article at a time, but many have access to the database and may update information about the article (expedite requests, etc.)

What I want is that if editor 1 enters his name as "reader," then editor 2 updates the information about the article, an email is automatically sent to editor 1.

Here's the catch- b/c I don't have administrator privileges on our network, I can't download any programs to run as part of this process. This means no outlook, no firefox, and primarily, no SMTP add ons. So, is there any way that I can either (1- preferred) send the emails through SMTP without downloading any auxiliary programs, or (2- not ideal but possible) have access open internet explorer, go to webmail, log in (to the journal's email), send the mail, and close IE? I would probably want it to be run on moving to the next record or (esp. for #2) on close of Access. If it makes it any easier, the database would always be run from the school's server, and all email addresses would be ones on the school's network (first.last@school.edu).

I'm a relative programming novice, so any help is greatly appreciated. Thank you!
-Adam

nico5038's Avatar
Moderator
 
Join Date: Nov 2006
Location: The Netherlands
Posts: 2,232
#2: Mar 25 '07

re: Can Access autosend email through SMTP (w/o download) or through squirrelmail?


I guess that the system manager closed the email for preventing spamm bots to work. This will however effect your application too.

The IE route could be an alternative. Just place the browser control and explore the possibilities for the HTMLdocument to achieve your goal.

Nic;o)
Denburt's Avatar
Moderator
 
Join Date: Mar 2007
Location: Louisiana
Posts: 1,218
#3: Mar 25 '07

re: Can Access autosend email through SMTP (w/o download) or through squirrelmail?


Have you tried
Expand|Select|Wrap|Line Numbers
  1. Docmd.SendObject acSendReport,"Your Report"
?
If that won't work you can try heading up and use CDO.

The problem is locating the exchange server, once you do that your in. There are a lot of commands some of which are commented out since they weren't needed for my purpose. I use this to export a report to html then use that as a html body for my e-mails. Works quite nicely once you find the server and get it up and running good luck let me know if I can help.
Oh and you will need to set a reference to CDO in the VBA window go to tools references and look for Microsoft CDO for exchange.

Expand|Select|Wrap|Line Numbers
  1. Public Function CPExp()
  2. Dim strTo As String, strFrom As String
  3. Dim stSub As String ' Subject
  4. Dim stMsg As String ' Body of Message
  5. Dim stRpt As String ' Name of Report
  6. Dim strCC As String
  7. Dim strBcc As String
  8. Dim iMsg As New CDO.Message
  9. Dim iConf As New CDO.Configuration
  10. Dim Flds
  11. Dim FSO, ts, tsR, i As Integer, Cnt(3)
  12. stRpt = "My Report"
  13. strTo = "1@2.com"
  14. strCC = "2@3.com"
  15. strBcc = "3@4.com"
  16. strFrom = "Me@4.com"
  17. stSub = "...My subject..."
  18. stMsg = "The attached file is the latest Example Report."
  19. DoCmd.OutputTo acOutputReport, "YourReport", acFormatHTML, Application.CurrentProject.Path & "\RD.HTML", False
  20.  
  21.  Set FSO = CreateObject("Scripting.FileSystemObject")
  22.  Set ts = FSO.OpenTextFile(Application.CurrentProject.Path & "\RD.HTML", ForReading, True) '.CreateTextFile(vFile)
  23.  tsR = ts.ReadAll
  24.  
  25. Application.CurrentProject.Path & "\RD.HTML", False
  26. Const cdoSendUsingPort = 2
  27. Const strSmartHost = "YourExchangeServer" 
  28. Set iMsg = CreateObject("CDO.Message")
  29. Set iConf = CreateObject("CDO.Configuration")
  30.  
  31. ' Set the configuration fields.
  32. Set Flds = iConf.Fields
  33.  
  34. ' Set the proxy server to be used.
  35. Flds.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
  36.  
  37. ' TODO: Set "someproxy:80" to the name of your proxy server.
  38. 'Flds("http://schemas.microsoft.com/cdo/configuration/urlproxyserver") = "?Exchangeserver"
  39. Flds.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSmartHost
  40.  
  41. ' Set if this is a local server.
  42. 'Flds("http://schemas.microsoft.com/cdo/configuration/urlproxybypass") = "<local>"
  43.  
  44. ' Set the option to retrieve the latest content directly from the server.
  45. Flds("http://schemas.microsoft.com/cdo/configuration/urlgetlatestversion") = True
  46. Flds.Update
  47.  
  48. ' Set the message properties.
  49. With iMsg
  50. Set .Configuration = iConf
  51. ' Create the MIME representation of the Web page in the message.
  52. '.CreateMHTMLBody = "http//whatever.com"
  53. .HTMLBody = tsR '"<html><body><p>Hello </p></body></html>"
  54. '.CreateMHTMLBody Application.CurrentProject.Path & "\RD.HTML"
  55. .To = strTo
  56. .CC = strCC
  57. .BCC = strBcc
  58. .From = strFrom
  59. .Subject = stSub
  60. .Send
  61.  
  62. Set .Configuration = Nothing
  63. Set Flds = Nothing
  64. Set iConf = Nothing
  65. Set iMsg = Nothing
  66.  
  67. End With
  68.  
  69. End Function
  70.  
Reply