Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Easier way to EMAIL from Access 1

Status
Not open for further replies.

wkendrvr

Programmer
Apr 25, 2002
29
US
I found that the MS updates were often causing issues with sending mail using Office XP (Bypassing the security dll's didn't seem to be the best way to handle it) So I set out to find a way to email without using Outlook.

I found a command line SMTP emailer that was open source called Blat. It also supports attachments!!


It is available here -=>
(To use this requires that you have access to a SMTP
server.)

Here is an example of simple code to call it


'------------------------------------------------------------
' sendmail
'
'------------------------------------------------------------
Function sendmail()
On Error GoTo sendmail_Err

Dim msg As String
Dim subj As String
Dim addr As String
Dim file As String

'addr - email address fully qualified
addr = "somebody@somewhere.com"
'file - this is the attached report of the run
file = "c:\runlog.doc"
'msg file this is the text of the message
msg = "c:\msg.txt"
'subject line
subj = "MDB_COMPACT_LOG"

' send mail using Blat mailer
Call Shell("blat " & msg & " -to " & addr & " -subject " & subj & " -hostname maildaemon -attach " & file, 1)


sendmail_Exit:
Exit Function

sendmail_Err:
MsgBox Error$
Resume sendmail_Exit

End Function



Currently I am using this to mail a report with the status of an automated repair and compact job.

Hope this helps someone!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top