I have a visual basic program that loops through an email table and sends out emails using MAPI. The problem is an age old one that I can not seem to figure out. Some of the users that I am sending to are getting a winmail.dat file instead of excel attachments. I have outlook 2000 and have changed the default send method to plain text. I do not have any contacts in my personal address book or contacts.
Here is the code
If File1.ListCount > 0 Then 'matching files found in the
MPMmessage.SessionID = MPSsession.SessionID
MPMmessage.Compose
MPMmessage.MsgSubject = "Weekly Sales Data from" "
MPMmessage.MsgNoteText = "This data"
MPMmessage.MsgIndex = -1
For ii = 0 To File1.ListCount - 1
ReDim Preserve sFound(UBound(sFound) + 1)
sFound(UBound(sFound) - 1) = sCurrPath & "\" & File1.List(ii)
nochange = sCurrPath & "\" & File1.List(ii)
'MPMmessage.AttachmentCount = File1.ListCount
MPMmessage.AttachmentIndex = ii
MPMmessage.AttachmentPosition = ii
MPMmessage.AttachmentPathName = nochange
MPMmessage.AttachmentName = File1.List(ii)
Next ii
If (ii) = File1.ListCount And (ii) <> 0 Then
'*************Get Email Address from Access****************
'Call GetEmail(CurrDir1, elist, email, Company)
strAppDir = CurrDir1
strDBName = strAppDir & "SalesEmail.mdb"
Set dbTable = OpenDatabase(strDBName)
Set rsField = dbTable.OpenRecordset("Select Email2,EmailName,Compname From tblEmail2 Where EmailName = '" & elist & "'"
With rsField
If Not rsField.EOF Then
Do Until rsField.EOF
DoEvents
email = rsField("Email2"
Company = rsField("Compname"
rsField.MoveNext
Loop
frmMapi.Refresh
frmMapi.Label3 = "Sending " & Company & " Emails"
frmMapi.Refresh
MPMmessage.RecipDisplayName = email
MPMmessage.RecipAddress = "smtp:" & email & ""
MPMmessage.MsgReceiptRequested = True
MPMmessage.Send True
------------------------------------
If MPMmessage.send is set to true I get a preview of the email. The email header says plain text. However if I right click the email address and go into properties the "Always send to this recipient in ms outlook rich text" is checked.
How can I default this to truely send as plain text. Do I have to set up these email addresses in my access table as contacts? Does this have something to do with me putting the smtp in front of the email address?(If I do not put smtp in front, the email sits in my outbox"
Any help would be greatly appreciated. Thanks
Here is the code
If File1.ListCount > 0 Then 'matching files found in the
MPMmessage.SessionID = MPSsession.SessionID
MPMmessage.Compose
MPMmessage.MsgSubject = "Weekly Sales Data from" "
MPMmessage.MsgNoteText = "This data"
MPMmessage.MsgIndex = -1
For ii = 0 To File1.ListCount - 1
ReDim Preserve sFound(UBound(sFound) + 1)
sFound(UBound(sFound) - 1) = sCurrPath & "\" & File1.List(ii)
nochange = sCurrPath & "\" & File1.List(ii)
'MPMmessage.AttachmentCount = File1.ListCount
MPMmessage.AttachmentIndex = ii
MPMmessage.AttachmentPosition = ii
MPMmessage.AttachmentPathName = nochange
MPMmessage.AttachmentName = File1.List(ii)
Next ii
If (ii) = File1.ListCount And (ii) <> 0 Then
'*************Get Email Address from Access****************
'Call GetEmail(CurrDir1, elist, email, Company)
strAppDir = CurrDir1
strDBName = strAppDir & "SalesEmail.mdb"
Set dbTable = OpenDatabase(strDBName)
Set rsField = dbTable.OpenRecordset("Select Email2,EmailName,Compname From tblEmail2 Where EmailName = '" & elist & "'"
With rsField
If Not rsField.EOF Then
Do Until rsField.EOF
DoEvents
email = rsField("Email2"
Company = rsField("Compname"
rsField.MoveNext
Loop
frmMapi.Refresh
frmMapi.Label3 = "Sending " & Company & " Emails"
frmMapi.Refresh
MPMmessage.RecipDisplayName = email
MPMmessage.RecipAddress = "smtp:" & email & ""
MPMmessage.MsgReceiptRequested = True
MPMmessage.Send True
------------------------------------
If MPMmessage.send is set to true I get a preview of the email. The email header says plain text. However if I right click the email address and go into properties the "Always send to this recipient in ms outlook rich text" is checked.
How can I default this to truely send as plain text. Do I have to set up these email addresses in my access table as contacts? Does this have something to do with me putting the smtp in front of the email address?(If I do not put smtp in front, the email sits in my outbox"
Any help would be greatly appreciated. Thanks