Jump to content

Email Handler...


veritas310

Recommended Posts

Hi,

I currently work with a rafting company and we use Opra, which is built into our Access 2003, and we're having some problems when trying to use a email handler. What we essentially want to be able to do is, when we receive a form from our website via email, we'd like to be able to then put that message into a folder in Outlook (ie: EmailHandlerQueue). From there, we open up the "Email Handler.mdb" and it has a drop down for Outlook folder which we then would point to our "EmailHandlerQueue" and from there we would ideally want it to input that into our Opra database, instead of manually having to enter each new request one by one. If anyone has experience with this, could you please respond and help us out, we'd greatly appreciate it! Thanks! :)

Link to comment
Share on other sites

  • 5 months later...

Can you show us what you have for code?

I have a mailer that we use and it references CDO..

Here is a snip of code we use:

Public Function Mailer(MailSubject)
Dim objEmail, stDocName, stFileName
'Dim msweb As String, smtp As String
Dim msweb, smtp, Subject, Stime, Etime, TimeTaken, Records, Rate, MailBody, MyStr As String
Dim varX As Variant
Set objEmail = CreateObject("CDO.Message")
objEmail.From = """Your Name"" <user1@company.com>"
objEmail.To = "user1@company.com;user2@company.com"
'objEmail.BCC = "5555551212@messaging.sprintpcs.com"
'objEmail.Subject = "your subject"
msweb = "http://schemas.microsoft.com/cdo/configuration/"
smtp = "smtp.yourcompany.com"

'Define the Error Table we want to work with
stDocName = "ErrorLog"

stFileName = "c:\sec\Errorlog.xls"

'Transfer the data from the table to the spreadsheet defined in the previous line
If IsNull(DLookup("[ID]", "Errorlog", "[ID] = 1")) Then 'Check to see if there are any errors
objEmail.Subject = "Report Info generated: " & Format(Now(), "dd mmm yyyy hh:mm") & " " 'Subject line
Else
objEmail.Subject = "Report and Error Info generated: " & Format(Now(), "dd mmm yyyy hh:mm") & " " 'Subject line
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, stDocName, stFileName
End If

'Output the report for e-mailing
varX = DLookup("[ID]", "TimeStamps", "[ID] = 1")
Stime = DLookup("[Stime]", "TimeStamps", "[ID] = 1")
Etime = DLookup("[Etime]", "TimeStamps", "[ID] = 1")
TimeTaken = DLookup("[TimeTaken]", "TimeStamps", "[ID] = 1")
Records = DLookup("[Records]", "TimeStamps", "[ID] = 1")
'Rate = Records / (Etime - Stime)
Rate = DLookup("[Rate]", "TimeStamps", "[ID] = 1")
MyStr = Format(Rate, "###0.00")
'objEmail.Subject = "Process is complete"
objEmail.Subject = objEmail.Subject & MailSubject
If DLookup("[ID]", "Errorlog", "[ID] = 1") Then
objEmail.Textbody = "Report Log and Errorlog Attached for Report: " & MailBody 'Message body
objEmail.AddAttachment (stFileName) 'Attach Excel File
Else
objEmail.Textbody = "Update Report Log for: " & MailBody 'Message body
End If

objEmail.Textbody = "Start Time: " & Stime & vbCrLf & "End Time: " & Etime
objEmail.Textbody = objEmail.Textbody & vbCrLf & "Time Taken: " & TimeTaken & " minutes" & vbCrLf & "Count: "
objEmail.Textbody = objEmail.Textbody & Records & " Records" & vbCrLf & "Rate: " & MyStr & " (records/minute)" & vbCrLf

objEmail.Configuration.Fields.Item(msweb & "sendusing").Value = 2
objEmail.Configuration.Fields.Item(msweb & "smtpserver").Value = smtp
objEmail.Configuration.Fields.Item(msweb & "smtpserverport").Value = 25
objEmail.Configuration.Fields.Update

If DLookup("[ID]", "Errorlog", "[ID] = 1") Then
Kill stFileName 'Remove the spreadsheet
End If

objEmail.Send
End Function

I used to use Outlook for e-mailing and it became a big pain as I had to use the "ClickYes" software for it.

Thanks,

Kent

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...