Solved

Sending mail through Outlook

Posted on 2002-03-23
10
150 Views
Last Modified: 2010-05-02
I use "Microsoft OutLook 9.0 Object Library" to send mails from my application. And I am facing the following problems.
A) In a few cases, I am required to change the from address of the mail that I send. Can this be done?
B) I need to set a hidden variable in the mail so that I will be able to browse the inbox and match the replies that I get for tha mails that I send. How do I do it?

Can anyone please help.

Sriram.
0
Comment
Question by:sriram_in
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 12

Expert Comment

by:roverm
ID: 6891414
Hi Sriram,

Are you sending the emails via an Exchange Server ?
If so: then you can change the from addy by direct accessing the pickup folder for exchange.

AFAIK it is not possible to send webmail via Outlook 9 as from another "from".

If you want to send emails via an SMTP server which allows different "from"s then you can use this:

http://www.freevbcode.com/ShowCode.Asp?ID=109

For the second part:
I don't know how to do that, I would try to read the subject.

Just one note:
These kind of questions can be seen as trying to build a spam application. I do think that you are sincere here.

D'Mzzl!
RoverM
0
 

Author Comment

by:sriram_in
ID: 6891853
Hi RoverM,

You can be assured that it is not a spamming software. This application will be deployed as an internal reporting tool.

I am sending mails through an Exchange Server. Using an SMTP server is ruled out. Can you clarify further about directly accessing the pickup folder?

Thanks,
Sriram.
0
 

Author Comment

by:sriram_in
ID: 6891856
If changing the from address is impossible, can you specify how to set the "Send replies to" address?
Thanks,
Sriram.
0
Independent Software Vendors: 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!

 
LVL 12

Expert Comment

by:roverm
ID: 6892010
Ok, but got the example at work, so please be patient, will post it monday. (CET+1)

D'Mzzl!
RoverM
0
 

Author Comment

by:sriram_in
ID: 6892015
Hi RoverM,
I had solved the first part. I used "SentOnBehalfOfName" property in the mailItem object to change the from address. The only problem with this method was that I needed to have access rights for the mailbox that I try to send from.

But, I still have the second issue pending.

Thanks,
Sriram.
0
 
LVL 12

Expert Comment

by:roverm
ID: 6892019
The SentOnBehalfOfName is not the same as altering the from. In the example I will give you, you don't need access rights. The only thing you need is access to that pickup folder (NT user rights).

I will look into the second part tho.

D'Mzzl!
RoverM
0
 
LVL 12

Accepted Solution

by:
roverm earned 100 total points
ID: 6902310
k, here's the example:

  'Parse form variables in mail text
  Dim objMail 'SMTPsvg.Mailer

  'Send mail
  Set objMail = CreateObject("SMTPsvg.Mailer")
 
  objMail.FromName = "SenderName"
  objMail.FromAddress = "SenderName@mysmtpserver.com"
  strMailHost = "HOSTNAME"
  objMail.RemoteHost = strMailHost
  objMail.AddRecipient "Someone", strReceipent
  objMail.ReturnReceipt = False
  objMail.ConfirmRead = False
  objMail.Subject = strSubject  
  objMail.BodyText = strBodyText
  objMail.AddAttachment strAttach

  If Not objMail.SendMail Then
     MsgBox "Error: " & objMail.Response
  End If
   
  Set objMail = Nothing

In this example the strMailHost is the hostname of your exchange server.

D'Mzzl!
RoverM
0
 

Author Comment

by:sriram_in
ID: 6902365
Hi RoverM,
I will need to use "Outlook.Application" to make the application. That was the challenge given to me.

Which library does "SMTPsvg.Mailer" belong? Also, if "SMTPsvg.Mailer" uses direct SMTP server calls, then it will not be of much use to me.

Sriram.
0
 
LVL 12

Expert Comment

by:roverm
ID: 6903269
I will check to which library it belongs, but thought it was the standard CDONTS dll.

It doesn't use direct SMTP calls because it connects to your exchange server.

D'Mzzl!
RoverM
0
 
LVL 1

Expert Comment

by:kodiakbear
ID: 7666202
Moving to the Paq

kb
Experts Exchange Moderator
0

Featured Post

Independent Software Vendors: 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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

752 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