Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 224
Default CDO, SMTP Server Name, and Excel's SendMail Method

I have an Excel VBA macro that sends mail using CDO. Works fine, but
users have to enter their SMTP Server in a designated cell.

In case a user doesn't know his SMTP Server, I allow the user to
choose, in a dropdown, whether to use CDO or Excel's SendMail, since
Excel's SendMail Method does not require specifying an SMTP Server.
Instead, according to the function reference, it uses "the installed
mail system" to send mail.

But CDO is much more versatile than Excel's SendMail, so I'd prefer to
be able to use CDO without expecting the user to know his SMTP Server.

Obviously, Excel's SendMail is somehow figuring out the SMTP Server.
I've found code to do this if the user has a mail account set up in
Outlook Express, but whatever Excel does works with or without an
Outlook Express mail account set up.

If Excel can do it, surely it must be possible to do it in another
program too. How can I determine the SMTP Server without regard to
what mail program is installed and set up with a mail account?


Thanks,


Greg

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default CDO, SMTP Server Name, and Excel's SendMail Method

Apologies in advance that this comment has little to do with a direct
answer to your question ... but ... did you check to see if you have
an object in your company's Active Directory that has the user's SMTP
(or Exchange Server) ?

If it does you can fetch it there.

That's probably where Excel's SendMail is getting it.

For simple examples of fetching data from Active Directory using VBA
see microsoft.public.scripting.vbscript. Simple queries in VBA and
VBScript are nearly identical. I've posted a few VBA examples there
myself.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 224
Default CDO, SMTP Server Name, and Excel's SendMail Method

Thanks, but wouldn't that require that the user be on an NT network?

Greg


On Jun 10, 11:10 am, "
wrote:
Apologies in advance that this comment has little to do with a direct
answer to your question ... but ... did you check to see if you have
an object in your company's Active Directory that has the user's SMTP
(or Exchange Server) ?

If it does you can fetch it there.

That's probably where Excel's SendMail is getting it.

For simple examples of fetching data from Active Directory using VBA
see microsoft.public.scripting.vbscript. Simple queries in VBA and
VBScript are nearly identical. I've posted a few VBA examples there
myself.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default CDO, SMTP Server Name, and Excel's SendMail Method

I don't know.

Are you running another implementation of LDAP?

I haven't tried to query other LDAP systems because I haven't been on
one to experiment.

How do you think Excel's SendMail knows?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default CDO, SMTP Server Name, and Excel's SendMail Method

If the user have a account in OE or Windows mail there is no need to fill in the SMTP server
http://www.rondebruin.nl/cdo.htm

There is code on this site if you want to know the SMTP server from Outlook
http://vbnet.mvps.org/


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Greg Lovern" wrote in message ups.com...
I have an Excel VBA macro that sends mail using CDO. Works fine, but
users have to enter their SMTP Server in a designated cell.

In case a user doesn't know his SMTP Server, I allow the user to
choose, in a dropdown, whether to use CDO or Excel's SendMail, since
Excel's SendMail Method does not require specifying an SMTP Server.
Instead, according to the function reference, it uses "the installed
mail system" to send mail.

But CDO is much more versatile than Excel's SendMail, so I'd prefer to
be able to use CDO without expecting the user to know his SMTP Server.

Obviously, Excel's SendMail is somehow figuring out the SMTP Server.
I've found code to do this if the user has a mail account set up in
Outlook Express, but whatever Excel does works with or without an
Outlook Express mail account set up.

If Excel can do it, surely it must be possible to do it in another
program too. How can I determine the SMTP Server without regard to
what mail program is installed and set up with a mail account?


Thanks,


Greg

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To send an email to a remote SMTP server Pierre Archambault Excel Programming 0 November 30th 06 12:31 AM
smtp server freddyb Excel Programming 1 November 28th 05 07:39 PM
How 2 remove this error - SMTP Server, Email using CDO Yongjun CHEN Excel Programming 1 March 23rd 05 08:47 PM
CDO_send can't communicate with smtp server Art Parra Excel Programming 6 February 15th 05 09:19 PM
SendMail Method Chris Excel Programming 1 December 3rd 03 02:48 PM


All times are GMT +1. The time now is 08:44 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"