Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Send Email with Attachment using MAPI

Posted on 2004-08-18
7
Medium Priority
?
376 Views
Last Modified: 2012-05-05
Well, i wanna send some emails with attachment, like pics for example. But all file types that i tried are converted to .dat files. So Me.jpg became Me.dat when i receive the email. I tryed all 3 attachmentype properties (mapDATA, mapEOLE, mapSOLE), nothing happens. Please, how can i send doc, jpeg, gif, exe files using MAPI? By the way, im using Visual Basic 6, Windows XP and Outlook Express. Thanks.
0
Comment
Question by:Shidartha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 11829563
Are you using MAPI controls? If so,have you tried:

With frmMain.MAPIMessages1
    .MsgIndex = -1
    .RecipDisplayName = "someone@somewhere.com"
    .MsgSubject = "Subject line"
    .AttachmentPathName = "C:\somefile.jpg"
    .MsgNoteText = "Body of Msg"
    .SessionID = frmMain.MAPISession1.SessionID
    .Send
End With
0
 

Author Comment

by:Shidartha
ID: 11829976
Didnt work :(

I'm using this code:

On Error GoTo TrataErro

'Inicializa uma seção MAPI
mpSession.UserName = "budd"
mpSession.Password = "budd"
mpSession.DownLoadMail = False
mpSession.LogonUI = False
mpSession.SignOn
mpMessage.SessionID = mpSession.SessionID
'Prepara e envia a mensagem
mpMessage.Compose
mpMessage.MsgIndex = -1
mpMessage.RecipAddress = "ssrosa@uai.com.br"
mpMessage.RecipDisplayName = "Sr. Papai"
mpMessage.MsgSubject = "Teste de Email"
mpMessage.MsgNoteText = Text1.Text
'Inclui o anexo
'mpMessage.AttachmentType = mapData
mpMessage.AttachmentName = "foto"
mpMessage.AttachmentPathName = "c:\foto1.jpg"
mpMessage.AttachmentPosition = Len(mpMessage.MsgNoteText)
mpMessage.Send
'Termina a seção
mpSession.SignOff
Exit Sub

TrataErro:
    MsgBox Error$, vbCritical, "Critical Error: " & Str(Err)
    End
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 11830167
Do you have to use MAPI or could you use a SMTP mailer?

See http://www.freevbcode.com/ShowCode.asp?ID=109
0
 

Author Comment

by:Shidartha
ID: 11832907
I discover the solution to my problem.

On
mpMessage.AttachmentName="foto"
i must use:
mpMessage:AttachmentName="foto.jpg"

Thanks all u guys.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12542532
PAQed, with points refunded (500)

modulo
Community Support Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question