Trying to use Redemption.SafeMailItem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Below is some old code I am using that works to e-mail reports (Access) but I
get the security pop-up prior to each e-mail. The code runs a series of
reports in Access based on different criteria (primarily different job
numbers). It e-mails a report then moves to the next report, e-mails it and
so on. I would like to get it to run through the reports without the
security pop-up. I have looked at the reference to this snippet:

objMailItem.Save
Set objSafeMail = CreateObject("Redemption.SafeMailItem")
objSafeMail.Item = objMailItem
objSafeMail.Send

but I don't know how to apply it to the DoCmd.sendObject in the code
provided. I have tryied several different things to no avail.

here's the portion of code that e-mails the reports:

strDocName = "LaborRePort"

DoCmd.SendObject acSendReport, strDocName, acFormatSNP, strTo, , ,
strJobNo + " Report for Last Week"
DoEvents
RS.MoveNext

Loop

Thanks in advance for any help.

Marc
 
Instead of using SendObject, use something along the lines below:

Set OutlookApp = CreateObject("Outlook.Application")
Set Namespace = OutlookApp.GetNamespace("MAPI")
Namespace.Logon

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem=OutlookApp.CreateItem(0)
SafeItem.Item = oItem

With SafeItem
..Subject = "Test"
..Recipients.Add "(e-mail address removed)"
..Recipients.ResolveAll
..Body = "This is a test"
..Send
End With


Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Dmitry -

Thanks for the repsonse - I have another question.
Where you show Body = "test", how would I attach the Access report (which is
a .snp file) to the e-mail?

Thanks again,

Marc
 
Dmirty,

I hope you can help this VBA neophyte out.

I downloaded the redemption exe from your website and installed in on my
computer. I changed my code to read as shown below but I get "Variable Not
Defined" at the Set OutlookApp = CreateObject("Outlook.Application") line.
If you have time, can you step me through this from the beginning?

DoCmd.RunCommand acCmdSaveRecord
Set mydb = DBEngine.Workspaces(0).Databases(0)

Me!txtProgress = Null

Set RS = mydb.OpenRecordset("Projects")
lngRSCount = RS.RecordCount
If lngRSCount = 0 Then
MsgBox "No email reports to send.", vbInformation
Else
RS.MoveLast
RS.MoveFirst
Do Until RS.EOF
lngCount = lngCount + 1


strTo = RS!netid
strJobNo = RS!LongJobNum

Set db = CurrentDb
Set rstVariables = db.OpenRecordset("Variables")

With rstVariables
.Edit
!LongJobNum = strJobNo
.Update
End With

strDocName = "LaborRecap"

Set OutlookApp = CreateObject("Outlook.Application")
Set Namespace = OutlookApp.GetNamespace("MAPI")
Namespace.Logon

Set SafeItem = CreateObject("Redemption.SafeMailItem")
Set oItem = OutlookApp.CreateItem(0)
SafeItem.Item = oItem

With SafeItem
.Subject = strJobNo + " Preliminary Labor Recap for Review"
.Recipients.Add strTo
.Recipients.ResolveAll
.Body = "Please review the attached Labor Recap for accuracy."
.Attachments.Add strDocName
.Send
End With

RS.MoveNext
Loop

Again, thanks in advance for your help.

Marc
 
The only way you can get an error at
Set OutlookApp = CreateObject("Outlook.Application")
is if Outlook is not installed.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool
 
Hello,
Is there a need to have administration rights to instal the Redemption
software ?
I don't have them at work, and I was wondering how to get rid of this
warning message.

Thank you for your comments.
BR
Didier
--------------------
 
Back
Top