Solved

Sending mail through Outlook

Posted on 2002-03-23
10
149 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
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

830 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