?
Solved

Sending an email via Outlook from a non-default address

Posted on 2011-05-11
13
Medium Priority
?
627 Views
Last Modified: 2012-05-11
Hi everyone,

I'm hoping someone here might be able to help me. I can send emails via outlook with no issue, as long as I'm sending from the default email account. Just create a MailItem, set the parameters and call Send. (EDIT: I'm using Office 2010)

However, what I'd like to do is change the "FROM" address. I've spent a long time searching google for a solution to this but I have been unsuccessful so far. Most of the solutions deal with changing the account itself (I have two set up, "Microsoft Exchange Server", and "Live Meeting Transport"). However, within the MS one, I have it set up to have access to multiple mailboxes. So what I'd like to do is change the outgoing mailbox, and not the outgoing account.

When sending emails manually, there is a dropdown above the "To" field where I can select other email addresses.

Anyone have any idea at all how to do this? And/or is there anywhere else you can suggest I ask? Is there a non-VBA solution that might work? I'm stumped here.... I'd hate to have to set up a second box just so I can log in as a different user to have it as the default addres...

Thanks!
0
Comment
Question by:m4trix
  • 9
  • 3
13 Comments
 
LVL 23

Expert Comment

by:Brian Gee
ID: 35741179
If you're trying to send emails from another account that currently exists, you would need to be added to the Delegates list of that account.

From Outlook 2010 of the account you want to send from, go to:

File > Info > Account Settings > Delegate Access

Add your name here and provision yourself with the access you want from the Delegates Permissions prompt.

Then you'll find that you can populate the From field from your Outlook client with this account's email address and send from it accordingly. This process may necessitate a restart of Outlook (on your account).
0
 
LVL 7

Author Comment

by:m4trix
ID: 35741375
yobri: I think you misunderstood my question. I already have access to two email addresses. In other words, when I compose a new message in the outlook client, I can do nothing, and it sends from my primary address, or change the "FROM" field to the other email account, and it will send from that account.

What I'm trying to do is write a macro in Excel that will send an email not from my default account, but from the secondary account.

So the question is really more a VBA question than an Outlook configuration question.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35741434
In fact, I should elaborate further - what I'm REALLY trying to do is send an email from the secondary account from PHP... I figure the only way I can do that is through the outlook COM object - which works the same way as through Excel.
0
Technology Partners: 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 4

Accepted Solution

by:
Ledigimate earned 2000 total points
ID: 35745773
If you're writing PHP scripts,  you can just use the  mail()  function to send an e-mail message.  Read the PHP ducumentation on the  mail()  function here.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35746007
Ledigimate: Unfortunately I'm running through a windows box, and in the 10 or so years I've been developing PHP, I've never found a good, reliable solution to getting email to work through PHP on windows machines.  This may be outside the scope of this question, but do you know how to get mail() working on windows? As far as I know I need an SMTP address (which I don't have)... I'm also not sure how mail coming from this particular address from outside the internal network will be treated by the exchange server....  It's worth exploring though if I can figure out how to get mail() working.  Thoughts?
0
 
LVL 4

Expert Comment

by:Ledigimate
ID: 35746359
You do need an SMTP server address for the PHP  mail()  function to work.  The SMTP address can be configured by an administrator in the  [mail function]  section of the   php.ini   file of the web server.  So if the SMTP server address can't be configured, you will not be able to use the  mail()  function in PHP.

I don't currently have the means to test-send a message to an exchange server myself, but i think it would be worth a shot once you have the correct SMTP server address configured.

In the mean while, other experts may be able to show you how to select the From address using the Outlook COM object, as I would first have to research that method.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35746392
I am the administrator of the web server, so I could put in an SMTP server... If I had one. Unfortunately I don't. Does exchange use one to send mail? If so then our company probably has one, but if so I'm not aware of it (obviously I don't know much about email protocols). I'll see what I can dig up on my own on that.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35747628
Ok, after doing a little bit more legwork, it seems that exchange does ultimately use an SMTP server, but if it is set to deny email relaying (which, as I understand it, is both the default and "best" setting), then it will not work. In other words, if I try to send email posing as being from this particular domain, and it is not originating from the exchange server itself, then it will block them.  I haven't tested this yet because I can't even find out what the SMTP server address is, but I expect that will be the result.
0
 
LVL 4

Expert Comment

by:Ledigimate
ID: 35748989
you *might* be able to discover the mail server address of your company if you query the dns server using the  nslookup  command at a command prompt.

if you know the I.P. address or host name of your DNS server, type the following at a command prompt and replace <server> with the I.P. addres or host name of the DNS server:

nslookup - <server>

at the nslookup prompt, type the following:

set type=MX

and then type the domain name of your company, for instance:

company.com

and then it should give you a list of servers, starting with the mail servers.
Note that those mail servers are not necessarily SMTP servers, but you can try them and see if that works.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35749106
Ledigimate: Thanks! It gave me the same address as the exchange server, so maybe it's all the same. I will give it a shot though and let you know. I've also put a request through to our IT people asking if there's anything that can be done. Nonetheless I think that we might be on the right track with using SMTP and the php mail command.  That's actually more robust (i hope) than going through an outlook instance as it will work even if outlook is closed.
0
 
LVL 7

Author Comment

by:m4trix
ID: 35749220
Awesome. It works perfectly.  You've solved my issue and saved me having to deal with Outlook. Thanks a bunch!
0
 
LVL 7

Author Comment

by:m4trix
ID: 35749237
PS - for those reading this solution, I actually used the PHP swiftmailer (http://swiftmailer.org) library instead of editing my php.ini file and using the built-in mail() function.
0
 
LVL 7

Author Closing Comment

by:m4trix
ID: 35749254
I didn't use the mail() function, but Ledigimate got me on the right track of sending email directly through a SMTP server instead of through Outlook
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

Question has a verified solution.

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

By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Today as you open your Outlook, you witness an error message: “Outlook is using an old copy of your Outlook Data File…”. Probably, Outlook is accessing an old OST file.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Suggested Courses

807 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