• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 376
  • Last Modified:

Lost MAPI attachments

Hello experts,
I'm using MAPI to send e-mail with attachments on our Novell network (GroupWise E-mail).  Works fine as long as I don't send anything to the internet - the message goes thru but the attachments are lost (unless they are text files).  It seems as if a pointer is attached instead of the actual file.  Here's the code I'm using:

Private Sub cmdExit_Click()
    MAPISession1.SignOff
    End
End Sub

Private Sub cmdSend_Click()
   
    MAPIMessages1.SessionID = MAPISession1.SessionID
    MAPIMessages1.MsgIndex = -1

'    MAPIMessages1.RecipDisplayName = "PEOPLE@OURDOMAIN.OURPO"     'This works fine
    MAPIMessages1.RecipDisplayName = "gwia:" + """" + "someone@somecompany.com" + """"   'This will not keep attachments unless text
   
    MAPIMessages1.ResolveName

    MAPIMessages1.MsgSubject = "This was done with vb"
    MAPIMessages1.MsgNoteText = "This e-mail generated and sent entirely with vb....."

    MAPIMessages1.AttachmentPathName = "c:\filename.htm"
    MAPIMessages1.AttachmentName = "filename.htm"
   
    MAPIMessages1.Send
   
End Sub

Private Sub Form_Load()
    MAPISession1.UserName = "Novell Default Settings"
    MAPISession1.SignOn

End Sub

I've tried MAPIMessages1.AttachmentType = 0, 1 and 2 to no avail.  The only type of file that seems to go thru to the internet is text.  I need to send HTML attachments.  Any ideas?
0
vbkeco
Asked:
vbkeco
  • 3
  • 2
1 Solution
 
vbkecoAuthor Commented:
Adjusted points to 75
0
 
setiawanCommented:
vbkeco, try this one
Private Sub Command1_Click()
    ' this command button is used to start a MAPI session, log on the
    '     the
    ' mail service, attach the created check summary text file to a n
    '     ew
    ' message, send the message and then close the session
    ' declare local variables here
    Dim strUserId As String
    Dim strPassword As String
    Dim strFileName As String
    Dim strFilePath As String
    ' set the mouse pointer to indicate the app is busy
    Screen.MousePointer = vbHourglass
    ' set the values for the file name and the file path
    strFileName = "sendmail.frm" ' this is where you would put any file attachments
    strFilePath = App.Path & "\"
    ' set the user name and password properties on the session contro
    '     l
    mapiLogOn.UserName = "user" ' network user name and password !
    mapiLogOn.Password = "testing"
    ' start a new email session
    mapiLogOn.SignOn


    Do While mapiLogOn.SessionID = 0


        DoEvents ' need to wait until the new session is created
        Loop

        'create a new message and address it
        MAPIMessages1.SessionID = mapiLogOn.SessionID
        MAPIMessages1.Compose
        MAPIMessages1.RecipDisplayName = "Danny Setiawan"
        MAPIMessages1.AddressResolveUI = True
        MAPIMessages1.ResolveName
        MAPIMessages1.RecipAddress = "smtp:ashiang@hotmail.com"
        ' note that I prefixed the address with "smtp". This is required
        '     by exchange
        ' server, or it does not know what service to use for outgoing ma
        '     il.
        MAPIMessages1.MsgSubject = "Test of the Email function"
        MAPIMessages1.MsgNoteText = " This is a test of the email function, If you" _
        & "receive this Then the program has worked successfully." & vbCrLf
        ' attaching the file
        MAPIMessages1.AttachmentPosition = Len(MAPIMessages1.MsgNoteText) - 1
        ' the line above places the attachment at the end of the text.
        MAPIMessages1.AttachmentPathName = strFilePath & strFileName
        ' now send the message
        MAPIMessages1.Send False
        mapiLogOn.SignOff
        MsgBox "File sent to specified receiptent."
        ' now set the mouse pointer back to normal
        Screen.MousePointer = vbNormal
End Sub

note : mapiLogOn is same as MAPISession1 ( rename   MAPISession1 to mapiLogOn

  regards
   
   danny
0
 
vbkecoAuthor Commented:
Thanks for looking at this Danny,

I tried your proposed method and have the same result: it works within our domain, but when sent thru our exchange server, the attachment is lost unless it is a text file.  Otherwise, what appears to go thru is only a pointer to the attachment.

Within our domain, the project works perfectly.

I must also point out that MAPIMessages1.ResolveName automatically adds the SMTP prefix to .RecipAddress, so the exchange server should know which outgoing mail service to use.  Also, you are correct in that I should be assigning a position for the attachment and I've fixed my code for this.

Danny, I am increasing the points on this, and I humbly offer them to you, but I am still faced with the original problem - I lose my attachments unless they are text files.  Please think some more on this and let me know if you come up with anything else.  I'll award you the points either way for correcting my mistakes, but I could really use an answer on this one.

Respectfully,
Steve
0
 
setiawanCommented:
Hi Steve,

Sorry for late reply, I think your problem is on 'attachment position'
but If It didn't solve your problem.

I think maybe you have to do some setting on your exchange, sorry I can't help you more, since I don't have Exchange Server.

I just curios, when you sending mail using MAPI, are you using Outlook Profiles or others ?

  danny
0
 
vbkecoAuthor Commented:
Thanks Danny,
I appreciate you looking at it just the same, and many thanks again for pointing out my other errors.  After your initial response, I changed my code to make certain that the attachment is located at the end of the message text.  Like you mentioned now, I'll probably have to change something on the exchange server - wish I knew more about this kind of thing.  It's wierd because if the attachment is a text file, it goes right on through.  Any other type gets lost.  I posted this same problem on the EE Netware forum but haven't gotten any replies as yet.  

To answer your question, the only available MAPI profile I have is "Novell Default Settings".  This consistes of 4 properties - 1) Novell Groupwise Address Book, 2) Novell Groupwise Message Store, 3) Novell Groupwise Transport, and 4) Novell Personal Address Book.  

Novell Groupwise Transport is the one that handles delivery.

Thanks again Danny!  If you happen to think of anything else I could try, I'd appreciate your input.

Best regards,
Steve
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now