472,783 Members | 992 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,783 software developers and data experts.

Outlook Problem

I have been using "mapi" to send mail from my vb applications for
some time. I am now working in vb.net. The problem I am having now is
that I need the "from" address to be different than the default one
for the user.

I could not find a way to change the "from" address when sending a
mail. Another way that would work would be to change to a different
email account or change the default account to something different. I
could find a way to do that either.

I finally solve it by setting by a second profile and logging on as the
alternate profile. This solution turned out to be unacceptable to the
user. For one thing she had to be completely log out of her normal
profile or it would work. Below is the code I use so you can see what
I'm doing.

Dim mobjOutlook As New Outlook.Application

Dim moItems As Outlook.Items

Dim moCt As Outlook.ContactItem
' Dim oCt As Outlook.DistListItem

Dim mobjmail As Outlook.MailItem
Dim mMyAttachments As Object

Dim oNS As Outlook.NameSpace = mobjOutlook.GetNamespace("mapi")
oNS.Logon(mProfilename, "", False, True) '
mobjmail = mobjOutlook.CreateItem(0)
' Send the mail
With mobjmail
.Subject = pSubject
.Body = pBody
.To = pTo
.CC = pcc
.BCC = pBcc

End With

Jul 21 '05 #1
0 1162

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Fritz Switzer | last post by:
Can anyone provide a small snippet in C# that pulls out the Contacts in Outlook XP. I've seen a couple of examples in C++ and VB in previous newsgroup posts, but either the originals didn't work...
by: VP | last post by:
g'day, i am posting a problem i have encountered with creating an email using outlook through some basic c# code. the problem arises when using different email editors in outlook. At the moment...
by: John | last post by:
Hi Is it possible to write vb.net code around outlook 2000 dlls and then use the code on ol2002 machines to send emails and bypass ol 2002 email block? Thanks Regards
by: John | last post by:
Hi When I open a new outlook email from vb.net, sometimes outlook is very slow to appear or occasionally outlook freezes completely. I am targeting mixed office2000/xp environments so I am...
by: Srinivas | last post by:
hi all how to access the outlook user profiles through VB.net any help.... thanks in advanc Srinivas
by: George McCullen | last post by:
I have an Outlook 2003 using Exchange Server 2003 Public Contacts Folder containing 20,000 Contacts. I am writing a VB .Net 2003 program that loops through all the contacts in a "for each oCt in...
by: damian | last post by:
Help! I created a COM addin using vb.net based on the KB article 302896 (http://support.microsoft.com/default.aspx?scid=kb;en-us;302896). The problem is Outlook remains in memory when after it. I...
by: Li Pang | last post by:
Hi, I used following codes to pass a message item from CDO to Outlook. They worked fine when I used outlook 2000, but get an error of "Specified cast is not valid." when I used Outlook 2003....
by: Siv | last post by:
Hi, A little while ago I asked if anyone could help me with how to create an email using MS Outlook that contained an embedded picture file. Thanks to Jay Harlow I was able to get this working...
by: JC | last post by:
Anybody knows what problem has this code? I think, in the Garbage Collector? You know the Solution? The program in the test's case, whit 350 contacts, run OK before number 86. The error is a...
by: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.