• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 656
  • Last Modified:

Sending an email via Outlook from a non-default address

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
m4trix
Asked:
m4trix
  • 9
  • 3
1 Solution
 
Brian GeeCommented:
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
 
m4trixAuthor Commented:
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
 
m4trixAuthor Commented:
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
LedigimateCommented:
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
 
m4trixAuthor Commented:
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
 
LedigimateCommented:
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
 
m4trixAuthor Commented:
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
 
m4trixAuthor Commented:
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
 
LedigimateCommented:
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
 
m4trixAuthor Commented:
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
 
m4trixAuthor Commented:
Awesome. It works perfectly.  You've solved my issue and saved me having to deal with Outlook. Thanks a bunch!
0
 
m4trixAuthor Commented:
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
 
m4trixAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 9
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now