Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

outlook property

Posted on 2003-11-20
3
Medium Priority
?
446 Views
Last Modified: 2008-02-01
I wrote a VB program that will automatically send emails.
What property do I have to set to alter who the mail is from?
0
Comment
Question by:tatlady
3 Comments
 
LVL 28

Expert Comment

by:vinnyd79
ID: 9787623
That depends on how you are sending the mail.
0
 

Author Comment

by:tatlady
ID: 9787751
the following code sits in a subroutine that has subject, mailto, and body passed to it.

Set objOutlook = CreateObject("Outlook.Application")
  Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
  objOutlookMsg.To = Trim(mailto)
  objOutlookMsg.subject = subject
  objOutlookMsg.body = body
  objOutlookMsg.Send
0
 
LVL 9

Accepted Solution

by:
TooKoolKris earned 200 total points
ID: 9787972
objOutlookMsg.From =

You can do this from a regular script as well. Just have to make sure your SMTP service is running:

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "whoever@domain.com"
objEmail.To = "whoever@mydomain.com"
objEmail.Subject = "Fresh Donuts"
objEmail.Textbody = "Tell the cops."
objEmail.Send
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question