Results 1 to 7 of 7

Thread: send email

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    10

    send email

    Hi all,
    I've a problen when I send e-mail using the CeateObject("Outlook.Application").

    The mail received have the characteristic of RFT type , if I use the .HTMLbody instead of .Body, it will be in HTML mode. )I've a file attached and no needs to write text.

    The thing I need is the "simulation" of the "Text" mode ... I'll explain. The manual operation is clicking with the right button of the mouse on a selected file ad use the send to (Outlook is the application used) ... the mail will open and have the characteristic of text mode, the attached file on bottom separated from the body where is possible to write text and where there is only the name of the file (not the path) . Another characteristic is the filename into the subject too.
    I hope I've described it correctly and I'll wait for your precious help for my first post.

    Thanks

  2. #2
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    From the help system in Outlook:
    Note: The EditorType property is not affected when you merely access the Body property of the item (as in MsgBox myItem.Body), but when you reset the Body property (as in myItem.Body = "This is a new body"), the EditorType reverts back to the user's default editor.

    The "users default editor" is typically the RTF format.

    The .EditorType is ReadOnly, so you can't use that to set the type of message. (Although it can be used to find out if the body is HTML, RTF or Text format).


    An alternative is to switch to using Simple MAPI, rather than the callable Outlook interface.
    Add MAPIsession and MAPImessages controls to your form.
    Add this code:
    VB Code:
    1. MAPISession1.SignOn
    2. With MAPIMessages1
    3.         .SessionID = MAPISession1.SessionID
    4.         .Compose
    5.         .RecipAddress = "[email protected]"
    6.         .ResolveName
    7.         .MsgSubject = "My Subject"
    8.         .MsgNoteText = "My body"
    9.         .AttachmentIndex = 0
    10.         .AttachmentPosition = 0
    11.         .AttachmentPathName = "c:\temp\test.txt"
    12.         .Send
    13. End With
    14. MAPISession1.SignOff

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    10
    I'm getting a runtime error when i doing the Signon

    Run-time error '424': Object required

    I must include library or something else or I missed to declare something ?

  4. #4
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    IF you have a MAPI compliant e-mail client (Outlook / Outlook Exp-ress)...
    IF you have a valid profile set up for using that client...
    IF you have added the correct MAPIsession and MAPImessage controls to your form...
    IF the names of those controls match the names used in the code...

    THEN it should work.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    10
    I've Outlook installed.

    I've a valid profile (with the CreateObject it works)
    I've just copied your code and modified only for e-mail, attached file and subject.

    It seems to be ok but run-time error go out at the first row of the sign on

    It is inside a sub and there are only other simple operation for find the file

  6. #6
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Newbury, UK
    Posts
    1,878
    I can get the same error number as you if I have my MAPIsession called something different.... so....

    Do you have the correct MAPIsession and MAPImessage controls on your form... and is the code you have entered using the same names as the controls are called.

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2003
    Posts
    10

    send mail *** RESOLVED ***

    GOT IT ... I've forget to include the MAPI object into the form.
    Now it work ... and is what i need ... Thanks !
    Last edited by locutus73; Feb 27th, 2003 at 07:38 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width