Results 1 to 10 of 10

Thread: E-Mail appendix

  1. #1
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Question Unanswered: E-Mail appendix

    Hi.

    I need to a attach a PDF file to a automatic generated e-mail from MS-Access. Can anyone help ? (Access XP)

    I tryed the "DoCmd.SendObject" command, but this one only allow me to attach HTML, text, Excel ... files.

    Thanks a lot.

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    try using outlook or express,

    i used this code to read emails from outlook so i should imagine that you can send this way as well

    Sub getMail()
    Dim inboxcontense As Outlook.Items, email As MailItem
    Dim rs As DAO.Recordset
    Set inboxcontense = CreateObject("Outlook.Application").GetNamespace(" MAPI").GetDefaultFolder(olFolderInbox).Items
    Set rs = CurrentDb.OpenRecordset("jobs", , dbAppendOnly)
    For Each email In inboxcontense
    With rs
    .AddNew
    !User = email.SenderName
    !DateReported = email.SentOn
    !DescriptionBrief = email.Subject
    !DescriptionFull = email.Body
    !Status = 1
    .update
    End With
    email.Delete
    Next
    rs.Close
    End Sub
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  3. #3
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251

    Set objOutlk = CreateObject("Outlook.Application")
    Set objMail = objOutlk.createitem(olMailItem)
    strMsg = "This is the first line of the email body!" & vbCrLf
    strMsg = strMsg & "This is the second line of the email body!" & vbCrLf

    With objMail
    .To = "me@domain1.com; me2@domain4.com"
    .cc = "me3@domain3.com"
    .subject = "Test email"
    .body = strMsg
    .attachments.add("c:\blabla.zip")
    .Send
    End With



    this works under Outlook. If you need the code for LOTUS NOTES or Outlook Express, let me know.

    note: if you have OutlookXP or Outlook with Security update, you will get popup message..... I posted few weeks ago message how to go around....



    jiri
    Last edited by playernovis; 01-27-03 at 16:56.

  4. #4
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Smile Lotus Notes appendix

    The final solution will be used under Lotus Notes, but my developer version need to be tested in Outlook. I have not tryed your proposal yet, but it look promising.

    Thanks a lot.

  5. #5
    Join Date
    Nov 2002
    Location
    San Francisco
    Posts
    251
    Lotus Notes has it's own API ... I just finished small project on posting documents to Lotus Notes Library....

    try this:

    http://www-10.lotus.com/ldd/today.ns...4?OpenDocument


    I had to use instead of
    CreateObject("Lotus.NotesSession")
    this
    CreateObject("Notes.NotesSession")

    and that's wahy I could not use some properties..... I hate LOTUS NOTES!


    so my final EMAIL looks like this:


    Dim Resp As Integer
    Dim Server As String
    Dim UserDef As String
    Dim DefFile As String
    Dim NOTESSESSION As Object
    Dim NOTESDATABASE As Object
    Dim NOTESDOCUMENT As Object
    Dim NotesRichText As Object

    Server = "MYLOTUSSERVER"
    UserDef = "MAIL\myname.nsf"

    Set NOTESSESSION = CreateObject("Notes.NotesSession")
    Set NOTESDATABASE = NOTESSESSION.GetDatabase(Server, UserDef)

    Set NOTESDOCUMENT = NOTESDATABASE.CreateDocument
    Set NotesRichText = NOTESDOCUMENT.CreateRichTextItem("Body")

    NOTESDOCUMENT.Subject = "test"
    NOTESDOCUMENT.body = "this is very small test"
    NOTESDOCUMENT.CreateRichTextItem("Attachment").Emb edObject 1454, "", "c:\myfile.txt", "attachment"
    NOTESDOCUMENT.SendTo = "myemail@yahoo.com"

    NOTESDOCUMENT.SaveMessageOnSend = False
    NOTESDOCUMENT.Send False


    jiri

  6. #6
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Angry Appendix in Outlook was OK

    Hi playernovis

    I tryed your proposal using Outlook. It works fine. Thanks !

    Now I will try your Notet proposal, that will be an challenge as I have no Notes currently installed on my PC.

    I'll let you know.


    vestigo

  7. #7
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    i gave the solusion a try as well and came up against an odd problem, on completion of the code the email excists in the outlook outbox but isn't sent any idea why?
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  8. #8
    Join Date
    Nov 2002
    Location
    Norway
    Posts
    239

    Angry Use Outlook as alternative to Notes mail

    In order to test mr. "playernovis " proposal I need to download a demo version of Notes. During the weekend I will spend some time to do further investigations. As an option I will try to use Outlook as an alternative, even if Notes is the preferred mailing system. I'll let you know the results next week.

    Vestigo

  9. #9
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    what ever the problem was it seems to have cured it's self very odd
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  10. #10
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    okay any ideas on how to chooses a profile to use when theres a choice?
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

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