Re: Email Programming using System.Web.Mail



Time for everyone to get on the same page I think.

The first thing that you need to confirm is that you are, in fact, using an instance of the System.Net.Mail.SmtpClient class to senn your emails.

If you're not then it's all back to square one.

If you are then it would be interesting to see how you instantiate the instance.

'The book' says that if you do not supply a target 'host', either in the constructor or by setting the Host property then the instance will use whatever is specified in your application or machine configuration files. (It will 'look' in the application configuration first but if that doesn't specify the appropriate information then it will fall back to the machine configuration file.) While it doesn't say so in so many words, it implies that it doesn't 'look' anywhere else, therefore I would expect that, if you don't specify it and it isn't specified in either of the configuration files, an exception would be thrown when you call the Send method.

I have just confirmed this by using:

Dim _client As New SmtpClient

_client.Send(New MailMessage("fromaddress", "toaddress", "Test", "Test"))

It results in an InvalidOperationException with the message 'The SMTP host was not specified.'.

The moment I specify a valid server then it works:

Dim _client As New SmtpClient("server")

_client.Send(New MailMessage("fromaddress", "toaddress", "Test", "Test"))



If you are definitely NOT specifying a 'host' in your code then that means that you MUST have a 'host' specified in one or more of your config files. All it is now, is a matter of you looking to see what it is. I know of no automatic mechanism that will put such information in the configuration files (but that doesn't mean such a mechanism doesn't exist).


The SmtpClient class is, as it's name suggests, a 'client' object and not a 'server' object. It will only connect to an 'up-line' SMTP server. If the recipient's 'mailbox' is not directly served by that server then the message will be relayed on to the appropriate server.


"Ed Bitzer" <edbitzer@xxxxxxxxx> wrote in message news:evO2gSIWIHA.5816@xxxxxxxxxxxxxxxxxxxxxxx

"rowe_newsgroups" <rowe_email@xxxxxxxxx> wrote in message news:d3d28beb-9f22-4180-a2bf-e0e83fb07327@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Jan 16, 12:19 pm, "Ed Bitzer" <edbit...@xxxxxxxxx> wrote:
I have been able using the namespace System.Web.Mail and its method
Smtp.mail.send to mail simple text messages to a small group within
our 55 and older community. I need help expanding the programs
capabilities. Searching this forum I did not find any related
information so if I have chosen poorly, I would appreciate a
suggestion of a more appropriate dotnet forum.

Now what I wish is the ability to send bcc's rather than to: (would be
sending to all 250 residents and would have to send in groups of 50 as
required by Comcast to curtail spammers) and also wonder if this
namespace handles base64 encoding so that I can send a pdf attachment.
Appreciate,

Ed

Though it might not help with encoding (not sure) two excellent sites
you need to check out are:

http://www.systemwebmail.com/

And

http://www.systemnetmail.com/

IMO if you are using 2.0 or higher you should be using System.Net.Mail

Thanks,

Seth Rowe [MVP]


Seith and Patrice too,



I have waded my way through all the references gave and digested sufficiently to create a prototype that sends an email To: somebody, with Bcc's to several others and can handle one or more pdf attachments encoded with Base64 - and it works<g>. Obviously you guys gave me excellent directions. I do have one more questions and that is how is this stuff getting to the recipients. I am sending from my home. I am providing system.web.mail with no information about my ISP. Does my program act as a Server and do its own thing looking up the DNS information for each of the recipients ISP's? When I use commercial software such as Thunderbird or OE I must spell out the smtp servicer and provide a username and password.



Ed



.



Relevant Pages

  • Re: Email Programming using System.Web.Mail
    ... configuration first but if that doesn't specify the appropriate ... configuration files, an exception would be thrown when you call the ... The moment I specify a valid server then it works: ... It will only connect to an 'up-line' SMTP ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Is there any point to full host names in /etc/hosts ?
    ... Specify an IP address to return for any host in the given ... Note that /etc/hosts and DHCP leases override ... server to avoid banner ads. ... it's important to be careful to avoid blocking useful domains that also host adverts. ...
    (comp.os.linux.networking)
  • Re: Index of/
    ... In previous posts you have said that, according to your host, the required ... and your host does not know the configuration of ... The usual home page on an Apache server is index.html, ... Get your present host to read the configuration files for your server to ...
    (microsoft.public.frontpage.client)
  • smtp relay to internal ok but not external!
    ... We are connecting to a windows 2000 exchange server and using it to ... ASP page is using its own SMTP virtual server to relay the email to ... our exchange server via it being specified as the smart host. ... Specify the Hosts That You Want to Openly Relay to All ...
    (microsoft.public.inetserver.iis.activeserverpages)
  • CDONTS sends internally but not externally
    ... We are connecting to a windows 2000 exchange server and using it to ... ASP page is using its own SMTP virtual server to relay the email to ... our exchange server via it being specified as the smart host. ... Specify the Hosts That You Want to Openly Relay to All ...
    (microsoft.public.inetserver.asp.components)