Solved

Sending mail through Outlook

Posted on 2002-03-23
10
148 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…

832 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