mpsahuja
May 24th, 2006, 11:03 PM
I am sending emails thru Outlook object in VB6. At one stage it was sending the mails properly.
Suddenly 2 things have started happening in Outlook:
1. The default mail sending account is not geting used anymore. It shows blank there. I have set
the default settings as plain text and not to send immdly.
2. .Body of the mailitem shows its matter properly when i debug and check thru .display. But
finally when .send is executed and I see the email in Outlook outbox, it has no text in body.
I have checked that the Fildata variable which contains body text contains proper values. I am
showing the values thru messagebox and display as well. It displays properly, but once in Outlook
outbox, email body matter vanishes.
And very rarely, once in a while the body contents also stay and do not vanish. Its quite
erratic.
But sender details are always blank, even after having a valid default email account.
If somehow I attach a file using .Attachments.Add, that attachment stays properly.
3. I am using VB6, with Win Xp - pro.
4. I have even tried disabling firewall and scanning for virus etc.
5. Here's the part of the code:
Private Sub DoMailingMSOutlook()
Dim objOutlook As Object
Dim objOutlookMsg As Object
'late binding method
Set objOutlook = CreateObject("Outlook.Application")
' we use zero argument as it is for new mail message
'Appointment 1; 'Contact 2; 'Distribution List 7
'Journal 4; 'Mail Message 0; 'Note 5 'Post 6; 'Task 3
Set objOutlookMsg = objOutlook.CreateItem(0)
strSubject = "MF " & strPortfolio
With objOutlookMsg
.To = "xyz@hotmail.com"
.Subject = strSubject
If FilDat = "" Then
MsgBox "No body text for '" & strPortfolio & "'", vbInformation, g_strPackage
Else
MsgBox "There is body text for '" & strPortfolio & "'", vbInformation, g_strPackage
MsgBox "Body text is: '" & FilDat & "'", vbInformation, g_strPackage
.Body = FilDat
.Attachments.Add FilName
.display
End If
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
6. Any suggestions on code ? And why the dafault mail account is not geting pircked up ?
Rgds
Suddenly 2 things have started happening in Outlook:
1. The default mail sending account is not geting used anymore. It shows blank there. I have set
the default settings as plain text and not to send immdly.
2. .Body of the mailitem shows its matter properly when i debug and check thru .display. But
finally when .send is executed and I see the email in Outlook outbox, it has no text in body.
I have checked that the Fildata variable which contains body text contains proper values. I am
showing the values thru messagebox and display as well. It displays properly, but once in Outlook
outbox, email body matter vanishes.
And very rarely, once in a while the body contents also stay and do not vanish. Its quite
erratic.
But sender details are always blank, even after having a valid default email account.
If somehow I attach a file using .Attachments.Add, that attachment stays properly.
3. I am using VB6, with Win Xp - pro.
4. I have even tried disabling firewall and scanning for virus etc.
5. Here's the part of the code:
Private Sub DoMailingMSOutlook()
Dim objOutlook As Object
Dim objOutlookMsg As Object
'late binding method
Set objOutlook = CreateObject("Outlook.Application")
' we use zero argument as it is for new mail message
'Appointment 1; 'Contact 2; 'Distribution List 7
'Journal 4; 'Mail Message 0; 'Note 5 'Post 6; 'Task 3
Set objOutlookMsg = objOutlook.CreateItem(0)
strSubject = "MF " & strPortfolio
With objOutlookMsg
.To = "xyz@hotmail.com"
.Subject = strSubject
If FilDat = "" Then
MsgBox "No body text for '" & strPortfolio & "'", vbInformation, g_strPackage
Else
MsgBox "There is body text for '" & strPortfolio & "'", vbInformation, g_strPackage
MsgBox "Body text is: '" & FilDat & "'", vbInformation, g_strPackage
.Body = FilDat
.Attachments.Add FilName
.display
End If
.Send
End With
Set objOutlookMsg = Nothing
Set objOutlook = Nothing
End Sub
6. Any suggestions on code ? And why the dafault mail account is not geting pircked up ?
Rgds