Date header missing - SendMail

  • Thread starter securitypl@wp.pl
  • Start date Views 1,604
S

securitypl@wp.pl

#1
Hi,

I am using MapiSendMail function to automate sending mails with
Outlook Express 6.0 on Win XP without operator's intervention (almost
- as there is a confirmation popup message box). MAPISendMail(0, 0,
msg, 0, 0) works perfectly for me but the DATE: header within the
mail is not generated and this is a serious problem because in some
mail readers it is either required and the missing date may cause to
qualify a message as spam or an empty space is left in the date
column. Sorry if this might have been asked in the past but it seems
that google search on usenet groups takes into account only recent
messages.

Ja

 
T

Twayne

#2
<securitypl@wp.pl> wrote in message
news:12d79082-da96-4183-be03-a016225a1769@x38g2000yqb.googlegroups.com
> Hi,
>
> I am using MapiSendMail function to automate sending mails with
> Outlook Express 6.0 on Win XP without operator's intervention (almost
> - as there is a confirmation popup message box). MAPISendMail(0, 0,
> msg, 0, 0) works perfectly for me but the DATE: header within the
> mail is not generated and this is a serious problem because in some
> mail readers it is either required and the missing date may cause to
> qualify a message as spam or an empty space is left in the date
> column. Sorry if this might have been asked in the past but it seems
> that google search on usenet groups takes into account only recent
> messages.
>
> Ja


Maybe a look around here might help:
http://omgili.com/mapisendmail
Quite a bit of info there. Most hits are forums and newsgroups and
other than your post, Google didn't show anything right off with your
particular problem.
I doubt very much it's an OE problem; more than likely you're just
missing a call to enther the date header or the date format isn't
manageable by the API.

The problem is probably in the code (C++ or whatever your'e working
with), mapi32.dll could be corrupted, things lke that. I've only ever
briefly dabbled with mapisendmail so I'm not a good reference but I do
know more background would have been good. Like, are you trying to
write directly to the Outbox and just use it for sending, or are you
trying to start OE and compose, then send? Etc.. You might also need
the oe dll and I think the win dll has some features you could use too;
but, I don't know enough to give any specifics..
http://www.codeguru.com/forum/showthread.php?t=384855 is the closest
I see to your problem but it has no solution although there is code;
maybe that will help somehow. Might be a good place to ask your question
though.

Someone more experienced will likely pop in, but this is really sort of
OT here, I think.

HTH,

Twayne`

 
S

Steve Cochran

#3
Did you try setting the date received in the MAPIMessage structure? I don't
know if that would fix it or not.

http://msdn.microsoft.com/en-us/library/dd296732(VS.85).aspx

steve

<securitypl@wp.pl> wrote in message
news:12d79082-da96-4183-be03-a016225a1769@x38g2000yqb.googlegroups.com...
> Hi,
>
> I am using MapiSendMail function to automate sending mails with
> Outlook Express 6.0 on Win XP without operator's intervention (almost
> - as there is a confirmation popup message box). MAPISendMail(0, 0,
> msg, 0, 0) works perfectly for me but the DATE: header within the
> mail is not generated and this is a serious problem because in some
> mail readers it is either required and the missing date may cause to
> qualify a message as spam or an empty space is left in the date
> column. Sorry if this might have been asked in the past but it seems
> that google search on usenet groups takes into account only recent
> messages.
>
> Ja
>


 
J
#4
On 8 Wrz, 14:13, "Steve Cochran" <scoch...@oehelp.com> wrote:
> Did you try setting the date received in the MAPIMessage structure?  I don't
> know if that would fix it or not.
>
> http://msdn.microsoft.com/en-us/library/dd296732(VS.85).aspx
>
> steve
>
> <securit...@wp.pl> wrote in message
>
> news:12d79082-da96-4183-be03-a016225a1769@x38g2000yqb.googlegroups.com...


Yes I have tried setting it to this date/time format string: "YYYY/MM/
DD HH:MM" but it seems to have no effect. If the MAPI_DIALOG flag is 8
(dialog window opens up) and the message sent with the 'SEND' button
then the "DATE:" header is inserted but not so when the flag is 0
(unattended)
 
J
#5
Hi,
This the sample code in question and it works (no DATE: though)
sending out e-mails through Outlook Express:

SendMessage
End Sub
Type MapiMessage
Reserved As Long
Subject As String
NoteText As String
MessageType As String
DateReceived As String
ConversationID As String
Flags As Long
Originator As Long
RecipCount As Long
Recipients As Long
FileCount As Long
Files As Long
End Type
Type MapiRecip
Reserved As Long
RecipClass As Long
Name As String
Address As String
EIDSize As Long
EntryID As String
End Type
Type MapiFileReserved As Long
Flags As Long
Position As Long
PathName As String
FileName As String
FileType As String
End Type
Declare Function MAPISendMail Lib "MAPI32.DLL" (ByVal Session&,ByVal
UIParam&, Message As MapiMessage, ByVal Flags&, ByVal Reserved&) As
Long
Sub SendMessage()
Dim rc As Long
Dim msg As MapiMessage
Dim recip(2) as MapiRecip
Dim body As String
recip(0).Name = StrConv("lon....@wp.pl",vbFromUnicode)
recip(0).Address = StrConv("smtp:lo....@wp.pl", vbFromUnicode)
recip(0).RecipClass = 1
recip(1).Name = StrConv("win....@wp.pl",vbFromUnicode)
recip(1).Address = StrConv("smtp:win....@wp.pl", vbFromUnicode)
recip(1).RecipClass = 2
msg.Subject = "My request"
Body = "Send me the file"
msg.NoteText = Body
msg.RecipCount = 2
msg.Recipients = VarPtr(recip(0))
msg.DateReceived = "Tue, 8 Sep 2009 20:47:03"
msg.Flags = 2
rc = MAPISendMail(0, 0, msg, 0, 0)
If rc <> 0 Then
MsgBox "Email failed; code = " & CStr(rc)
End If

Jan
 
J
#6
On 8 Wrz, 21:11, Jan <securit...@wp.pl> wrote:
> Hi,
> This the sample code in question and it works (no DATE: though)
> sending out e-mails through Outlook Express:
>
> SendMessage
> End Sub
> Type MapiMessage
> Reserved As Long
> Subject As String
> NoteText As String
> MessageType As String
> DateReceived As String
> ConversationID As String
> Flags As Long
> Originator As Long
> RecipCount As Long
> Recipients As Long
> FileCount As Long
> Files As Long
> End Type
> Type MapiRecip
> Reserved As Long
> RecipClass As Long
> Name As String
> Address As String
> EIDSize As Long
> EntryID As String
> End Type
> Type MapiFile
>Reserved As Long
> Flags As Long
> Position As Long
> PathName As String
> FileName As String
> FileType As String
> End Type
> Declare Function MAPISendMail Lib "MAPI32.DLL" (ByVal Session&,ByVal
> UIParam&, Message As MapiMessage, ByVal Flags&, ByVal Reserved&) As
> Long
> Sub SendMessage()
> Dim rc As Long
> Dim msg As MapiMessage
> Dim recip(2) as MapiRecip
> Dim body As String
> recip(0).Name = StrConv("lon....@wp.pl",vbFromUnicode)
> recip(0).Address = StrConv("smtp:lo....@wp.pl", vbFromUnicode)
> recip(0).RecipClass = 1
> recip(1).Name = StrConv("win....@wp.pl",vbFromUnicode)
> recip(1).Address = StrConv("smtp:win....@wp.pl", vbFromUnicode)
> recip(1).RecipClass = 2
> msg.Subject = "My request"
> Body = "Send me the file"
> msg.NoteText = Body
> msg.RecipCount = 2
> msg.Recipients = VarPtr(recip(0))
> msg.DateReceived = "Tue, 8 Sep 2009 20:47:03"
> msg.Flags = 2
> rc = MAPISendMail(0, 0, msg, 0, 0)
> If rc <> 0 Then
> MsgBox "Email failed; code = " & CStr(rc)
> End If
>
> Jan


Also tried:
msg.DateReceived = "2009/09/08 20:47"
but DateReceived seems to be ignored
the same as MAPI_RECEIPT_REQUESTED flag, in this case: msg.Flags = 2
 
S

Steve Cochran

#7
Well after further investigation, it appears that this problem has existed
since OE4 and was never fixed, so I guess you can't do anything about it.

You can peruse this:

http://groups.google.com/groups/search?hl=en&q=+MAPISendMail++date&sitesearch=&sa=N&start=30

steve

"Jan" <securitypl@wp.pl> wrote in message
news:00dd58c1-e2fc-4ca8-ab73-281eb6c0d2bb@c37g2000yqi.googlegroups.com...
On 8 Wrz, 14:13, "Steve Cochran" <scoch...@oehelp.com> wrote:
> Did you try setting the date received in the MAPIMessage structure? I
> don't
> know if that would fix it or not.
>
> http://msdn.microsoft.com/en-us/library/dd296732(VS.85).aspx
>
> steve
>
> <securit...@wp.pl> wrote in message
>
> news:12d79082-da96-4183-be03-a016225a1769@x38g2000yqb.googlegroups.com...


Yes I have tried setting it to this date/time format string: "YYYY/MM/
DD HH:MM" but it seems to have no effect. If the MAPI_DIALOG flag is 8
(dialog window opens up) and the message sent with the 'SEND' button
then the "DATE:" header is inserted but not so when the flag is 0
(unattended)

 
S

Steve Cochran

#8
Yeah, it appears that field is ignored.

steve

"Jan" <securitypl@wp.pl> wrote in message
news:f0b86c6d-39a4-42cc-aa13-aacb809c8851@q7g2000yqi.googlegroups.com...
> On 8 Wrz, 21:11, Jan <securit...@wp.pl> wrote:
>> Hi,
>> This the sample code in question and it works (no DATE: though)
>> sending out e-mails through Outlook Express:
>>
>> SendMessage
>> End Sub
>> Type MapiMessage
>> Reserved As Long
>> Subject As String
>> NoteText As String
>> MessageType As String
>> DateReceived As String
>> ConversationID As String
>> Flags As Long
>> Originator As Long
>> RecipCount As Long
>> Recipients As Long
>> FileCount As Long
>> Files As Long
>> End Type
>> Type MapiRecip
>> Reserved As Long
>> RecipClass As Long
>> Name As String
>> Address As String
>> EIDSize As Long
>> EntryID As String
>> End Type
>> Type MapiFile
>>Reserved As Long
>> Flags As Long
>> Position As Long
>> PathName As String
>> FileName As String
>> FileType As String
>> End Type
>> Declare Function MAPISendMail Lib "MAPI32.DLL" (ByVal Session&,ByVal
>> UIParam&, Message As MapiMessage, ByVal Flags&, ByVal Reserved&) As
>> Long
>> Sub SendMessage()
>> Dim rc As Long
>> Dim msg As MapiMessage
>> Dim recip(2) as MapiRecip
>> Dim body As String
>> recip(0).Name = StrConv("lon....@wp.pl",vbFromUnicode)
>> recip(0).Address = StrConv("smtp:lo....@wp.pl", vbFromUnicode)
>> recip(0).RecipClass = 1
>> recip(1).Name = StrConv("win....@wp.pl",vbFromUnicode)
>> recip(1).Address = StrConv("smtp:win....@wp.pl", vbFromUnicode)
>> recip(1).RecipClass = 2
>> msg.Subject = "My request"
>> Body = "Send me the file"
>> msg.NoteText = Body
>> msg.RecipCount = 2
>> msg.Recipients = VarPtr(recip(0))
>> msg.DateReceived = "Tue, 8 Sep 2009 20:47:03"
>> msg.Flags = 2
>> rc = MAPISendMail(0, 0, msg, 0, 0)
>> If rc <> 0 Then
>> MsgBox "Email failed; code = " & CStr(rc)
>> End If
>>
>> Jan

>
> Also tried:
> msg.DateReceived = "2009/09/08 20:47"
> but DateReceived seems to be ignored
> the same as MAPI_RECEIPT_REQUESTED flag, in this case: msg.Flags = 2


 

Similar threads

Top