Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2004, 09:45 AM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Outlook 2002 - mailing from DB

Folks

At work we are trying to pull ourselves in to the real world and use a database to send e-mails out to people within our company using a standard format but with information specific to them included. For example we mail a manager that his team members [names] need to confirm that training has been completed etc.

I've managed to figure out how to send the mail from my own mailbox, but we also have a group mailbox that a reply from the user can be picked up from by anyone of 6 people. The question is how can I send it from the group mailbox not my own?

At the present I have send on behalf permissions to the group account, and in the FROM box on the message I select the account I want to use.

Here's the code I managed to get working:

Sub subMessageSend(sMsgBody As String, sRecipient As String)

Dim objMailItem As Outlook.MailItem
Dim sSubject As String

Set olkApp = New Outlook.Application

Set olkNameSpace = olkApp.GetNamespace("MAPI")
Set objMailItem = olkApp.CreateItem(olMailItem)

sSubject = "This is a Test Message from Access 2000"
sMsgBody = "This is the message body..." & vbCrLf & vbCrLf & sMsgBody

With objMailItem
    .To = sRecipient
    .Importance = olImportanceHigh
    .Recipients.ResolveAll
    .Subject = sSubject
    .Body = sMsgBody
    .ReadReceiptRequested = False
    .Send
End With

Set objMailItem = Nothing
Set olkNameSpace = Nothing
Set olkApp = Nothing


End Sub

I haven't tried it yet but I guess I could create a new mail profile with just the Group Mailbox in it...

Any thoughts/suggestions gladdy accepted.


Regards

Russ (Programing on L plates..!)
__________________
Regards

Russ (Programing on L plates..!)
 
Old August 25th, 2004, 01:49 PM
Authorized User
 
Join Date: Jun 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Since putting this question forward I've actually answered my own question. I found that if i used the SentOnBehalfOfName property with the group account we use, then it sends the message correctly.

So a new message would state to the recipient:

From: Russ Ford Sent on Behalf of IT Department

When the user clicks Reply the To field is addressed as IT Department

You probably knew this anyway but being as I'm a learner I thought I'd mention it...


Regards

Russ (Programing on L plates..!)





Similar Threads
Thread Thread Starter Forum Replies Last Post
About Mailing List ssomchai BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 May 5th, 2008 10:05 PM
mailing manish_partey ASP.NET 1.0 and 1.1 Professional 1 April 25th, 2007 08:20 AM
Mailing prashanth_kumarbv Classic ASP Basics 2 October 27th, 2006 08:40 PM
Outlook 2002 - Anti Spammer fordrs3 VB How-To 0 August 25th, 2004 01:45 PM
about mailing using CDONTS anurag_j_r Classic ASP XML 1 March 12th, 2004 04:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.