I send a attachment in mail on VB and user receives without extension of file.

My problem is that I send a mail within attachment (example: file.doc), the user receives this mail with file but this file without it extension, only "file". The user doesnt knows what type is this file, if is a Word file or a Excel file or other file.

The code of Vb mail:
Me.MAPIMessages1.AttachmentIndex = Me.MAPIMessages1.AttachmentCount

Me.MAPIMessages1.AttachmentType = 0

Me.MAPIMessages1.AttachmentPosition = Me.MAPIMessages1.AttachmentIndex

Me.MAPIMessages1.AttachmentPathName = "c:\sendmail\pedido.doc"

Me.MAPIMessages1.AttachmentName = "Pedido.Doc"

Me.MAPIMessages1.Send

ogirAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

setiawanCommented:
Hi ogir,

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
manojaminCommented:
try this

            Me.MAPIMessages1.AttachmentName = ""
            ' position must be at the end of the message body - 1, read the help file
            Me.MAPIMessages1.AttachmentPosition = Len(Me.MAPIMessages1.MsgNoteText) - 1

Me.MAPIMessages1.AttachmentPathName = "c:\sendmail\pedido.doc"

'get rid of this
'Me.MAPIMessages1.AttachmentName = "Pedido.Doc"
0
ogirAuthor Commented:
OK
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.