INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Classes and Objects

Email with Attachment - Freeware JMail by craigsboyd
Posted: 6 Jul 03 (Edited 21 Dec 04)

Slighthaze = NULL

***Requires FREEWARE  w3 JMail  Free, v 4.3
***Download at http://www.dimac.net/
***If the above link ever gets broken email me at craig@sweetpotatosoftware.com


PUBLIC oSMTPMail
oSMTPMail = NEWOBJECT("jmail.SMTPMail")
***If you aren't sure leave this commented out
***let the object figure it out for you if possible
***oSMTPMail .ServerAddress = "mail.mchsi.com"

oSMTPMail.AddRecipient ("craig1442@mchsi.com")
oSMTPMail.Sender = "Slighthaze@somewhere.com"
oSMTPMail.SenderName = "SlightHaze"
oSMTPMail.Subject = "Sending AutoExec as Attachment..."
oSMTPMail.Body = "Hello World!  Here is my AutoExec.bat file."
oSMTPMail.AddAttachMent ("C:\AutoExec.bat")
oSMTPMail.Execute()
RELEASE oSMTPMail

***In order to receive/download email messages you would
***need the professional version of JMail which is NOT freeware
***I am not advocating it, just wanted to provide an example of
***downloading messages and their attachments with JMail
***(Thanks to ShyFox for asking about it)

LOCAL oPop3, oMessages, nMsgCount, nCounter
LOCAL oMsg, oAttaches, nAttachCount, nCounter2, oAtt

oPop3=CREATEOBJECT("jmail.pop3")
oPop3.connect("username","password","mail.somehost.com")
oPop3.DownloadMessages()
oMessages=oPop3.Messages
nMsgCount=oMessages.count()
FOR nCounter = 1 TO nMsgCount
    oMsg = oMessages.Item(nCounter)
    ?oMsg.Date
    ?From
    ?FromName
     ?Priority
    ?Subject
    ?Body
     oAttaches = oMsg.Attachments
     nAttachCount = oAttaches.count()
    FOR nCounter2 = 1 TO nAttachCount
        oAtt = oAttaches.Item(nCounter2)
        ? oAtt.ContentType
        ? oAtt.Size
        =STRTOFILE(oAtt.Data,oAtt.Name)
    ENDFOR
ENDFOR

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close