General discussion

Locked

Mail from Access with attachment

By hiteshbiyani ·
I am currently using Access database to design a daily MIS which is used for reporting.
I now want to automate the e-mail reporting with the help of Access. I want to include some standard lines in the mail which will get generated from access. I tried to use macro - send object option but it has limitation of 255 characters. Is there any way i can extend the character limitation. Also, i want to attach the file to the e-mail which will be sent out.

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

This is how to do it in AutoIt

by JackOfAllTech In reply to Mail from Access with att ...

Which is very similar to VB. If you're any good you should be able to translate.

Func MailIt()
Local $oNewMail


$g_oOutlook = ObjGet("", "Outlook.Application")
If @Error then
MsgBox(16, $VERSION, "Outlook does not appear to be running")
Exit
EndIf

WinActivate("- Outlook")

$oNewMail = $g_oOutlook.CreateItem($olMailItem)
If Not IsObj($oNewMail) then
MsgBox(16, $VERSION, "Error creating new mail item")
Exit
EndIf

$oNewMail.Recipients.Add("_QRM")
If $oNewMail.Recipients.Count <> 1 then
MsgBox(16, $VERSION, "Error adding '_QRM' distribution list")
Exit
EndIf

If Not $oNewMail.Recipients.ResolveAll then
MsgBox(16, $VERSION, "Error adding '_QRM' distribution list")
Exit
EndIf

$oNewMail.Subject = "QRM: " & $g_sPDate
$oNewMail.Body = ""

$oNewMail.Attachments.Add(@ScriptDir & "\QRM_CriticalPath.xls")

; $oNewMail.Save
$oNewMail.Send
EndFunc

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums