PC Review


Reply
Thread Tools Rate Thread

CDO, SMTP Server Name, and Excel's SendMail Method

 
 
Greg Lovern
Guest
Posts: n/a
 
      10th Jun 2007
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 With Quote
 
 
 
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      10th Jun 2007
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.

 
Reply With Quote
 
Greg Lovern
Guest
Posts: n/a
 
      10th Jun 2007
Thanks, but wouldn't that require that the user be on an NT network?

Greg


On Jun 10, 11:10 am, "gimme_this_gimme_t...@yahoo.com"
<gimme_this_gimme_t...@yahoo.com> 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.



 
Reply With Quote
 
gimme_this_gimme_that@yahoo.com
Guest
Posts: n/a
 
      10th Jun 2007
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?

 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      10th Jun 2007
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" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
>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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
*Another* OLK 2002 sendmail/SMTP problem =?Utf-8?B?c3RldmllZ2I=?= Microsoft Outlook Discussion 11 23rd Mar 2005 12:59 AM
SMTP Server does not relay from sendmail method =?Utf-8?B?am9obmZsZW0=?= Microsoft Dot NET 0 2nd Jul 2004 12:56 PM
Outlook 2003 SMTP TLS fails on any port except 25 w/ Sendmail 8.12.11/8.12.10 publicnews.microsoft.com Microsoft Outlook Discussion 0 28th May 2004 04:59 PM
sending asp.net smtp sendMail of UTF-8 unicode contents peterson Microsoft ASP .NET 0 30th Dec 2003 09:14 AM
SendMail Method Chris Microsoft Excel Programming 1 3rd Dec 2003 02:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:17 PM.