When i send bulk mails when i want to switch it Off. When i select No while selecting the macro directly. It gets into a phase where for all emails sent it asks for delivery and read receiptiant.

Hi,

Below code is from David.

The below code ask's me if i want a delivery notice and read notice on each email sent it pop's up.

When i send bulk mails when i want to switch it Off. When i select No while selecting the macro directly. It gets into a phase where for all emails sent it asks for delivery and read receiptiant.
When i say No i want it to stop requesting for receptiants and when i selected Yes it has to ask for all without prompting each time. On Close and open of Outlook it has to get back to the normal phase of asking me on each mail sent.

Regards
Sharath
Sub ReceiptSwitch()
'Read and delivery report swtch
 
    bolReadReceipt = Not bolReadReceipt
    bolDeliveryReceipt = Not bolDeliveryReceipt
    MsgBox "Read and delivery receipts are now " & IIf(bolReadReceipt, "on", "off")
End Sub
 
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim olkRecipient As Outlook.Recipient
    For Each olkRecipient In Item.Recipients
        LogAddress olkRecipient.Name, olkRecipient.Address
    Next
    Set olkRecipient = Nothing
    toMe Item
    If (Not bolReadReceipt) And (Not bolDeliveryReceipt) Then
        If MsgBox("Do you want receipts for this message?", vbQuestion + vbYesNo, "Request Receipts") = vbYes Then
            Item.ReadReceiptRequested = True
            Item.OriginatorDeliveryReportRequested = True
        End If
    Else
        Item.ReadReceiptRequested = bolReadReceipt
        Item.OriginatorDeliveryReportRequested = bolDeliveryReceipt
    End If
    'CheckFollowUp Item, Cancel
    Item.Save
End Sub

Open in new window

LVL 11
bsharathAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

peakpeakCommented:
A read or delivery receipt is quite futile to use as it can give a false negative when the receiving mail system does not support these kind of messages. If you're not receiving a receipt you might be of the impression the mail is not read when it actually is. It's all dependend on the recipients mail system.
0
David LeeCommented:
Hi, Sharath.

Why don't you just set the switch to off before you send a bulk message?  That is a lot easier and won't require changing the code.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

bsharathAuthor Commented:
David when i set it to Off it takes it as Read & Deliver for all mails automatically without asking me Yes/No
0
David LeeCommented:
You don't want receipts for the bulk messages, correct?  If so, then what we need is another switch for bulk mails.  If that switch is on, then no receipts at all.  Will that work?
0
bsharathAuthor Commented:
Yes David...
One option to get a popup each sent email
Another option to Keep it on on all emails another option to keep it off always
0
David LeeCommented:
Ok.  I've added a new switch for sending bulk mail.  When it is on you will not be prompted and receipts will not be requested.  When it is off, then you will be prompted for receipts based on whether the other two switches are on or off.  You'll need to create another toolbar button to control the bulk mail switch.
'Add this to your existing code'
Private bolBulkMail As Boolean

'Adde this subroutine to your existing code'
Sub BulkMailSwitch()
    bolBulkMail = Not bolBilkMail
    MsgBox "The bulk mail switch is now " & IIf(bolBulkMail, "on", "off")
End Sub

'Replace the existing Application_ItemSend subroutine with the version below' 
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim olkRecipient As Outlook.Recipient
    For Each olkRecipient In Item.Recipients
        LogAddress olkRecipient.Name, olkRecipient.Address
    Next
    Set olkRecipient = Nothing
    toMe Item
    If Not bolBulkMail Then
        If (Not bolReadReceipt) And (Not bolDeliveryReceipt) Then
            If MsgBox("Do you want receipts for this message?", vbQuestion + vbYesNo, "Request Receipts") = vbYes Then
                Item.ReadReceiptRequested = True
                Item.OriginatorDeliveryReportRequested = True
            End If
        Else
            Item.ReadReceiptRequested = bolReadReceipt
            Item.OriginatorDeliveryReportRequested = bolDeliveryReceipt
        End If
    End If
    'CheckFollowUp Item, Cancel
    Item.Save
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsharathAuthor Commented:
David Should i replace the whole code with the above?

Can you post the full code editted if its not just this...Please..
0
bsharathAuthor Commented:
Hi David ...Just a reminder when time permits....
0
David LeeCommented:
Sharath,

I'm not clear on what you mean when you ask "Should i replace the whole code with the above?"  The answer is "yes" for the code for this question but "no" for all the code you have in ThisOutlookSession.  
0
bsharathAuthor Commented:
Should i replace the code in the class or Thisoutlooksession
0
David LeeCommented:
ThisOutlookSession
0
bsharathAuthor Commented:
Thank U David
0
David LeeCommented:
You're welcome.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.