Received date empty

Status
Not open for further replies.
M

Marc

Created an Outlook mail item programmatically

and sent it by using Redemption safemailitem.

Next I created a new folder in Personal Folders

and dragged and dropped that sent mail item in to that

new folder from Sent Items folder.

Then I checked the Received date value of the mail,

that is empty. This is my VFP code to send mails.

Pls someone help..

poOutlook = CREATEOBJECT("Outlook.Application")

loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)

loRedemption = CREATEOBJECT("Redemption.SafeMailItem")

loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)

loRedemption.Item = toOutBox.Items.Add(0)

loEmailItem = loRedemption

loEmailItem.To = "chamara@sltnet.lk"

loEmailItem.Subject = "Test received date "+TTOC(DATETIME())

loEmailItem.BodyFormat = 1

loEmailItem.Body = "Test received date"

loOutBoxMailItem = loEmailItem.Move(loOutBox)

loMailItem = CREATEOBJECT("Redemption.SafeMailItem")

loMailItem.Item = loOutBoxMailItem

loMailItem.Send()
 
K

Ken Slovak - [MVP - Outlook]

I fail to understand the logic of what you're doing.

You are creating an email item in the Outbox, which is usually something not

done, assigning it to a SafeMailItem, moving the SafeMailItem to the same

folder it's already in as a different SafeMailItem, creating yet another

SafeMailItem, assigning that from the superfluous SafeMailItem you just

created, and then sending that final item.

Is there a reason for all this pretzel logic?

Why not just follow the KISS principle:

poOutlook = CREATEOBJECT("Outlook.Application")

loMail = poOutlook.CreateItem(0)

loMail.To = "chamara@sltnet.lk"

loMail.Subject = "Test received date "+TTOC(DATETIME())

loMail.BodyFormat = 1

loMail.Body = "Test received date"

loRedemption = CREATEOBJECT("Redemption.SafeMailItem")

loRedemption.Item = loMail

loRedemption.Send()

"Marc" <dummy@abcd.com> wrote in message

news:ObNw6foNKHA.3384@TK2MSFTNGP04.phx.gbl...

> Created an Outlook mail item programmatically
> and sent it by using Redemption safemailitem.
> Next I created a new folder in Personal Folders
> and dragged and dropped that sent mail item in to that
> new folder from Sent Items folder.
> Then I checked the Received date value of the mail,
> that is empty. This is my VFP code to send mails.
> Pls someone help..

> poOutlook = CREATEOBJECT("Outlook.Application")
> loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)
> loRedemption = CREATEOBJECT("Redemption.SafeMailItem")
> loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)
> loRedemption.Item = toOutBox.Items.Add(0)
> loEmailItem = loRedemption
> loEmailItem.To = "chamara@sltnet.lk"
> loEmailItem.Subject = "Test received date "+TTOC(DATETIME())
> loEmailItem.BodyFormat = 1
> loEmailItem.Body = "Test received date"
> loOutBoxMailItem = loEmailItem.Move(loOutBox)
> loMailItem = CREATEOBJECT("Redemption.SafeMailItem")
> loMailItem.Item = loOutBoxMailItem
> loMailItem.Send()
>
 
M

Marc

Thanks Ken,

According to your code the mail store in Drafts

folder until it send. But I want to move that mail item

in to my Outbox and send.
<kenslovak@mvps.org> wrote in message

news:uWh4kStNKHA.5488@TK2MSFTNGP02.phx.gbl...
> I fail to understand the logic of what you're doing.

> You are creating an email item in the Outbox, which is usually something
> not
> done, assigning it to a SafeMailItem, moving the SafeMailItem to the same
> folder it's already in as a different SafeMailItem, creating yet another
> SafeMailItem, assigning that from the superfluous SafeMailItem you just
> created, and then sending that final item.

> Is there a reason for all this pretzel logic?

> Why not just follow the KISS principle:

> poOutlook = CREATEOBJECT("Outlook.Application")

> loMail = poOutlook.CreateItem(0)
> loMail.To = "chamara@sltnet.lk"
> loMail.Subject = "Test received date "+TTOC(DATETIME())
> loMail.BodyFormat = 1
> loMail.Body = "Test received date"

> loRedemption = CREATEOBJECT("Redemption.SafeMailItem")
> loRedemption.Item = loMail
> loRedemption.Send()

> >

>

> "Marc" <dummy@abcd.com> wrote in message
> news:ObNw6foNKHA.3384@TK2MSFTNGP04.phx.gbl...
>

>> Created an Outlook mail item programmatically
> > and sent it by using Redemption safemailitem.
> > Next I created a new folder in Personal Folders
> > and dragged and dropped that sent mail item in to that
> > new folder from Sent Items folder.
> > Then I checked the Received date value of the mail,
> > that is empty. This is my VFP code to send mails.
> > Pls someone help..
>

>> poOutlook = CREATEOBJECT("Outlook.Application")
> > loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)
> > loRedemption = CREATEOBJECT("Redemption.SafeMailItem")
> > loOutBox = poOutlook.GetNameSpace("MAPI").GetDefaultFolder(4)
> > loRedemption.Item = toOutBox.Items.Add(0)
> > loEmailItem = loRedemption
> > loEmailItem.To = "chamara@sltnet.lk"
> > loEmailItem.Subject = "Test received date "+TTOC(DATETIME())
> > loEmailItem.BodyFormat = 1
> > loEmailItem.Body = "Test received date"
> > loOutBoxMailItem = loEmailItem.Move(loOutBox)
> > loMailItem = CREATEOBJECT("Redemption.SafeMailItem")
> > loMailItem.Item = loOutBoxMailItem
> > loMailItem.Send()
> >

>
 
K

Ken Slovak - [MVP - Outlook]

That's just cosmetic, but if that's what you want just add a line to move

the item to Outbox before calling Send on that referenced moved item.

"Marc" <dummy@abcd.com> wrote in message

news:ufomKxzNKHA.1232@TK2MSFTNGP05.phx.gbl...
> Thanks Ken,
> According to your code the mail store in Drafts
> folder until it send. But I want to move that mail item
> in to my Outbox and send.
 
G

Gianluca Vannozzi

" - " wrote:


> That's just cosmetic, but if that's what you want just add a line to move
> the item to Outbox before calling Send on that referenced moved item.

> >

>

> "Marc" <dummy@abcd.com> wrote in message
> news:ufomKxzNKHA.1232@TK2MSFTNGP05.phx.gbl...
> > Thanks Ken,
> > According to your code the mail store in Drafts
> > folder until it send. But I want to move that mail item
> > in to my Outbox and send.


>


Hi, can i ask you to post just few lines to move it to SentItems ?

Thank you very much.
 
D

Dmitry Streblechenko

Replace the line

loRedemption.Item = toOutBox.Items.Add(0)

with

loOutlookItem = poOutlook.CreateItem(0)

loOutlookItem = loOutlookItem .Move(loOutBox )

loRedemption.Item = loOutlookItem

Dmitry Streblechenko (MVP)

-

"Gianluca Vannozzi" <Gianluca Vannozzi> wrote in

message news:A3A635C6-9D87-4745-80A1-87A54029E572@microsoft.com...

> " - " wrote:
>
> > That's just cosmetic, but if that's what you want just add a line to move
> > the item to Outbox before calling Send on that referenced moved item.
>

>> > >

> >

>

>
>
>
>
>
>> "Marc" <dummy@abcd.com> wrote in message
> > news:ufomKxzNKHA.1232@TK2MSFTNGP05.phx.gbl...
> > > Thanks Ken,
> > > According to your code the mail store in Drafts
> > > folder until it send. But I want to move that mail item
> > > in to my Outbox and send.

>

>>


> Hi, can i ask you to post just few lines to move it to SentItems ?
> Thank you very much.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
W Save and rename outlook email attachments to include domain name & date received Outlook VBA and Custom Forms 4
M Outlook VBA Macro that could retrieve/display the (From, Subject, Date Received) Outlook VBA and Custom Forms 2
A Received Date None after reading Using Outlook 2
R Received as just date Outlook VBA and Custom Forms 6
S Outlook 365 Help me create a Macro to make some received emails into tasks? Outlook VBA and Custom Forms 0
S How to find emails that I sent that have not received a reply? Using Outlook 7
D Create new email from the received Email Body with attachment Outlook VBA and Custom Forms 10
N Please advise code received new mail Using Outlook 0
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
E Conditional formatting - when current account <> received account ? Using Outlook 3
C Add Form to Appointments Received, Automatically Outlook VBA and Custom Forms 6
A VBA macro for 15 second loop in send and received just for 1 specific mailbox Outlook VBA and Custom Forms 1
B One email cannot be sent or received (but leaves outbox!) Using Outlook 1
K Conditional Formatting based on Department of person received from? Outlook VBA and Custom Forms 4
mctabish Replying to an email if received in several inboxes Outlook VBA and Custom Forms 2
A Multiple Outlook Invites Received by One Person Using Outlook 4
dyny723 Outlook 2016: Code to link a contact to emails received from that contact Outlook VBA and Custom Forms 1
S Custom user fields in received messages Outlook VBA and Custom Forms 1
S Received mail as part of DL, need to auto-CC the same when replying Outlook VBA and Custom Forms 5
I Forwarding attachments in email received Outlook VBA and Custom Forms 3
T Received many email without information Using Outlook 1
C Auto save outlook attachments when email is received Outlook VBA and Custom Forms 1
Bob Franklin Emails Not Received in my Outlook account Using Outlook 1
D Help with code to move mail on receipt to another folder based on time received Outlook VBA and Custom Forms 2
P How to make outlook display alert appear on top of other windows whenever a new email is received? Outlook VBA and Custom Forms 1
C Save Subject of Received Email as a String Outlook VBA and Custom Forms 1
H send reminder if no reply received on first or original email using macro Using Outlook 2
D Outlook 2007 e-mail header- How to set font & font size in received message headers ? Using Outlook 2
T Automatically open link in email received Outlook VBA and Custom Forms 33
N Auto-forwarding an Email received from a specific Email address After slight modifications Using Outlook 4
J Changing margins in received email display Using Outlook 3
S Updating the database based on received task Outlook VBA and Custom Forms 3
M Outlook mail to agile from specific folders as the mail is received Using Outlook 3
M How do I mark emails already received as read when I get a second, different email based on subject? Outlook VBA and Custom Forms 3
D Messages received from only one sender arrive with dark gray text background Using Outlook 1
Hudas Run Macro when an Email is received Using Outlook 4
Y All emails are received with delay on outlook 2010 Using Outlook 5
D See Email Address Received Email was Sent To? Using Outlook 1
E Saving Changes To Edited E-Mail Received Message Using Outlook 0
J Automatically Print PDF When They Are Received Using Outlook 4
C Exchange 2010 / Emails received show with display name and not email address Using Outlook 2
Z Trigger macro to run after a new mail is received in Outlook? Using Outlook 3
D show my alias in my received messages Using Outlook 1
K Save a received email in a mailbox subfolder which is the same as the @email Using Outlook 1
A automatically remove flag from original message when a response was received Using Outlook 2
L Shared calendar appointments received as emails, stays in inbox! Using Outlook 1
K received bcc as encrypted Using Outlook 12
H Automatic excel data added to Certain Emails that are received Using Outlook 3
S OL 2010 shortcut to edit received mail Using Outlook 3
Commodore Button for Send/Received for a specific account Using Outlook 4

Similar threads

Top