Select(Alias()) Go 1 oleMAPISession = Createobject( "MSMAPI.MAPISession.1" ) Select(Thisform.DB_name.Value) Go Top the_email=Alltrim(Thisform.DB_name.Value)+"."+Alltrim(Thisform.email_field.Value) * Signon to mail With oleMAPISession .UserName = Thisform.user_name.Value .Password = Thisform.pass_wd.Value .Signon() * Check the SignOn status If (.SessionID > 0) oleMAPIMessages = Createobject( "MSMAPI.MAPIMessages.1" ) * tell the message the SessionID oleMAPIMessages.SessionID = .SessionID Else Return Endif Endwith Count=1 * Send an email With oleMAPIMessages Do While .Not. Eof() && Loop to step through database If .Not. Empty(&the_email) && Do Not try to process empty email fields .Compose() * Set the Recipient name and resolve .RecipDisplayName = Alltrim(&the_email) .RecipType = 1 .ResolveName() .MsgSubject = Thisform.subject.Value && .MsgNoteText ="Hello dear" && tested && .MsgNoteText = _CLIPTEXT && tested && .htmlbody = "<HTML><H2>This is HTML Mail.</H2><BODY>" && Outlook Only && Tested && .MsgNoteText = Filetostr(Thisform.path_to_message.Value) && Tested .MsgNoteText="For Outlook Express - Click on source tab and past text, HTML" If .Not. Empty(Thisform.path_to_attachment.Value) && Skip if no path to attachment .AttachmentPathName=(Thisform.path_to_attachment.Value) && Full path and filename Endif If Count=1 .Send(1) && On first pass stop mail client to get message Else .Send(.F.) && On all subsequent passes send email without stopping Endif Wait Window Str(Count)+' '+(&the_email) Timeout 1 && Timeout 1 second so as not to put mail server into shock Count=Count+1 Endif Skip Enddo oleMAPISession.Signoff() &&Remember to close mail client Endwith Return