'email script
Public Sub CreateEmailWithOutlook()
Forms!frmMain.Requery
'bits for the attachment
Dim myPath As String
Dim sTo As String
Dim pDHL As String 'to try and add the dhl logo
Dim pSAIN As String 'to try and add the sainsburys logo
pDHL = "G:\GENERAL\PCC\Compliance\Compliance Database\SigPictures\dhl.jpg" 'dhl logo path
pSAIN = "G:\GENERAL\PCC\Compliance\Compliance Database\SigPictures\sainsburys.jpg" 'sainsburys logo path
sTo = Forms!frmMain!txtHiddenEmail.Value
myPath = "G:\GENERAL\PCC\Compliance\Compliance Database\FailureReport\"
strReportName = "Failure Report.pdf"
' Create a new email object
Set olApp = CreateObject("Outlook.Application")
Set olMailItem = olApp.createitem(olMailItem)
' Add the To/Subject/Body to the message and display the message
With olMailItem
.To = sTo
.cc = "PCCMgr.DAVEDepot@sainsburys.co.uk"
.Subject = "PCC Supplier Compliance Failure Notification"
.HTMLBody = "<html><body><font face=calibri>Dear Supplier,<br><br>Please find attached a non-compliance form and photos, for Pre-advice XXXXXXXX<br><br>If you have any questions regarding the above compliance failures please reply to this email within 14 days to contest or request further information. <br><br>If this compliance issue is not contested, we will decide, what we believe is the best outcome. <br><br>Issues cannot be queried after the 14 day period is over. <br><br> Kind Regards <br><br>Christopher Mawby<br>PCC Compliance Administrator<br>Sainsbury's Distribution Centre <br>Daventry International Rail Freight Terminal <br>Brassey Way <br>Kilsby <br>CV23 8BQ<br><br> <A HREF=mailto:QC.DAVEDepot@sainsburys.co.uk>QC.DAVEDepot@sainsburys.co.uk</A><br>Tel: 01788 206630 <br> <img src ='" & pDHL & "'> For <img src ='" & pSAIN & "'> </font> </body> </html>"
.Attachments.Add myPath & strReportName 'FileName"
.Display ' Displays before sending the message
End With
' Release all object variables
Set olMailItem = Nothing
Set olApp = Nothing
DoCmd.Close acReport, "rpt_FailureReport"
End Sub