473,624 Members | 2,269 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problems with System.Net.Mail

Hi,

I have written some very simple code that runs within my website that
use system.web.mail to send an email using the SMTP server here. It
works fine. However when I alter the code to work using system.net.mail
instead and put the code in a VB.NET class library it no longer works.
It does not raise an exception though. The mail just does not get sent.

Does anyone have an idea as to why this might be? Hers the code that
does not work:

Dim oMsg As MailMessage = New MailMessage
Dim oAdd As MailAddress
Dim SmtpMail As SmtpClient = New
SmtpClient(SMTP _SERVER)

'Create email notification
oMsg.From = New MailAddress(ATL S_EMAIL)
oAdd = New MailAddress("me @me.com")
oMsg.To.Add(oAd d)
oMsg.Subject = "whatever"

'TODO - put name in here of location manager
oMsg.Body = "stuf...."

SmtpMail.Send(o Msg)

Heres the code that does work:

Dim oMsg As MailMessage = New MailMessage()
oMsg.From = AppSettings("AT LS_EMAIL")
oMsg.To = "me@me.com"
oMsg.Subject = "whatever"
oMsg.BodyFormat = MailFormat.Html
SmtpMail.SmtpSe rver = AppSettings("SM TP_SERVER")
SmtpMail.Send(o Msg)

Sep 5 '06 #1
1 1362
There's code differences between sending mail with
system.web.mail and sending mail with system.net.mail .

For complete examples using system.net.mail , see :

http://www.systemnetmail.com/

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
=============== =============== =====
"Proteus" <pr************ @gmail.comwrote in message
news:11******** *************@e 3g2000cwe.googl egroups.com...
Hi,

I have written some very simple code that runs within my website that
use system.web.mail to send an email using the SMTP server here. It
works fine. However when I alter the code to work using system.net.mail
instead and put the code in a VB.NET class library it no longer works.
It does not raise an exception though. The mail just does not get sent.

Does anyone have an idea as to why this might be? Hers the code that
does not work:

Dim oMsg As MailMessage = New MailMessage
Dim oAdd As MailAddress
Dim SmtpMail As SmtpClient = New
SmtpClient(SMTP _SERVER)

'Create email notification
oMsg.From = New MailAddress(ATL S_EMAIL)
oAdd = New MailAddress("me @me.com")
oMsg.To.Add(oAd d)
oMsg.Subject = "whatever"

'TODO - put name in here of location manager
oMsg.Body = "stuf...."

SmtpMail.Send(o Msg)

Heres the code that does work:

Dim oMsg As MailMessage = New MailMessage()
oMsg.From = AppSettings("AT LS_EMAIL")
oMsg.To = "me@me.com"
oMsg.Subject = "whatever"
oMsg.BodyFormat = MailFormat.Html
SmtpMail.SmtpSe rver = AppSettings("SM TP_SERVER")
SmtpMail.Send(o Msg)

Sep 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
3976
by: anders | last post by:
Hi! I have a config file that looks like this: <?xml version="1.0" encoding="utf-8" ?> <configuration> <system.runtime.remoting> <application> <service> <wellknown mode="SingleCall" type="Interfaces, IMyFirstRemotableObj" objectUri="ControlCenter" /> </service>
17
2469
by: Lloyd Sheen | last post by:
This IDE is driving me nuts. I needed another button so I copied an existing one, changed the Text and the id and position by drag and drop. Well then I run and get the following: Control 'Button19' of type 'Button' must be placed inside a form tag with runat=server Can the IDE not do what it is supposed to do. It seems that it is a fight to make it do anything or did I do something wrong? It would seem silly to have to create a...
2
1497
by: Rene | last post by:
Hi all i need some help. i try to send mail with the following code. Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim mailMsg As New MailMessage mailMsg.From = rene.fehr@netradox.com mailMsg.To = info@netradox.com mailMsg.Subject = "Testmail vom Webforum" mailMsg.Body = "some body text"
12
1287
by: DanB | last post by:
When I try to send email using the System.Web.Mail namespace I get an exception of Could not Create CDO.message object. FYI - I worked for a long time with a similar exception of "Could not create CDO.message object". I think I resolved that by registering CDO.dll. I am running VB.NET 2002, Framework 1.0 (Even though I have installed
11
2186
by: Steve Smith | last post by:
I have written a winforms application that launches approximately 150 threads with Thread.ThreadStart() Each thread uses CDO 1.21 to logon to a different Exchange mailbox and send/receive a number of mail messages, reporting back to the UI thread through the use of a Queue object. When all messages that are expected have been received, each thread sends a final update to the UI and the method should exit, which should terminate the...
3
4270
by: armando perez | last post by:
Hi, this is my first time here, but I was looking for something that may help me, and still, I haven't found something to use. I'm using a website made in .NET with C#, when I'm running my site from my PC, everything seems right, but when I publish the website, and send it to my real website, everything works but the mail sending. I have red some groups and topics, and everywhere I can found: - Use the following syntax: <system.net>
8
2482
by: Mike Owen | last post by:
Hi, I am using the following code to send email on a Windows 2003 Web Server: Imports System.Net.Mail ........ Dim msgmail As New MailMessage msgmail.To.Add(New MailAddress(objMember.EmailAddress)) msgmail.From = New
2
2220
by: Eugene Vital | last post by:
Hi all I am having trouble with sending email via a C#2.0 application, I use the same settings as I use in Outlook but I cannot get email to send. I am trying to use SSL on port 465 and get the error below, If I disable SSL and use port 587 all goes well. I have been Googling for 2 days without success and this seems to be a common problem.
34
5333
by: Alexnb | last post by:
Gerhard Häring wrote: No, it didn't work, but it gave me some interesting feedback when I ran it in the shell. Heres what it told me: Traceback (most recent call last): File "<pyshell#10>", line 1, in <module> os.startfile("C:\Documents and Settings\Alex\My Documents\My
0
8240
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8680
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7168
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
1791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.