473,761 Members | 10,684 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

This mail sending code snippet does not work

Dim message As New MailMessage("my ****@mydomain.c om", "my****@mydomai n.com",
"Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient.Sen d(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob


Nov 4 '06 #1
8 2006
Robert,

First of all do you need to set IIS as SMTP server, that is not standard,
you can use the Microsoft tab in the add programs config for that.

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc******** ******@TK2MSFTN GP02.phx.gbl...
Dim message As New MailMessage("my ****@mydomain.c om",
"my****@mydomai n.com", "Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient.Sen d(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob


Nov 5 '06 #2
I'm getting back error Mailbox unavailable. The server response was: 5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine

"Robert Dufour" <bd*****@sgiims .comwrote in message
news:Oc******** ******@TK2MSFTN GP02.phx.gbl...
Dim message As New MailMessage("my ****@mydomain.c om",
"my****@mydomai n.com", "Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient.Sen d(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob


Nov 5 '06 #3
Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was: 5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin from
another machine on the LAN and I think maybe this is a security issue, where
I have to specify an SMTP server name, username and password, but I can't
find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu******** ******@TK2MSFTN GP02.phx.gbl...
Robert,

First of all do you need to set IIS as SMTP server, that is not standard,
you can use the Microsoft tab in the add programs config for that.

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc******** ******@TK2MSFTN GP02.phx.gbl...
>Dim message As New MailMessage("my ****@mydomain.c om",
"my****@mydoma in.com", "Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient.Se nd(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob



Nov 5 '06 #4
Robert,

Normaly you get tons of links to this website, therefore I gave you my first
thought the problem was.

http://www.systemwebmail.com/

I hope this helps,

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:uF******** ******@TK2MSFTN GP04.phx.gbl...
Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was: 5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin from
another machine on the LAN and I think maybe this is a security issue,
where I have to specify an SMTP server name, username and password, but I
can't find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu******** ******@TK2MSFTN GP02.phx.gbl...
>Robert,

First of all do you need to set IIS as SMTP server, that is not standard,
you can use the Microsoft tab in the add programs config for that.

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Dim message As New MailMessage("my ****@mydomain.c om",
"my****@mydom ain.com", "Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient.S end(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob




Nov 5 '06 #5
I also tested to use localhost using system.web.mail instead of the new
system.net.mail
I get an exception : the transport could not connect to the host when using
localhost as the smtp server. When using my mail server outside of my lan
where I am normally hosted(mail.myc ompany.com) the message goes through.

There seems to be something wrong with the localhost smtp server but I can't
figure out what.
This is the code snippet I used for that test.

Dim mail As New System.Web.Mail .MailMessage()

mail.To = "bd*****@sgiims .com"

mail.From = "bd*****@sgiims .com"

mail.Subject = "this is a test email."

mail.Body = "this is my test email body"

SmtpMail.SmtpSe rver = "mail.mycompany .com" 'This works OK but localhost does
not

Try

SmtpMail.Send(m ail)

Catch ex As Exception

MsgBox(ex.Messa ge)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uj******** ******@TK2MSFTN GP04.phx.gbl...
Robert,

Normaly you get tons of links to this website, therefore I gave you my
first thought the problem was.

http://www.systemwebmail.com/

I hope this helps,

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:uF******** ******@TK2MSFTN GP04.phx.gbl...
>Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was:
5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin
from another machine on the LAN and I think maybe this is a security
issue, where I have to specify an SMTP server name, username and
password, but I can't find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu******* *******@TK2MSFT NGP02.phx.gbl.. .
>>Robert,

First of all do you need to set IIS as SMTP server, that is not
standard, you can use the Microsoft tab in the add programs config for
that.

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc****** ********@TK2MSF TNGP02.phx.gbl. ..
Dim message As New MailMessage("my ****@mydomain.c om",
"my****@mydo main.com", "Test", "Test")

Dim emailClient As New SmtpClient("loc alhost")

emailClient. Send(message)

The IIS server is running on the local machine.

What am I missing to make this work reliably?

Thanks for any help

Bob




Nov 5 '06 #6
Robert,

Did you already try the IP address of your local computer?

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I also tested to use localhost using system.web.mail instead of the new
system.net.mai l
I get an exception : the transport could not connect to the host when
using localhost as the smtp server. When using my mail server outside of
my lan where I am normally hosted(mail.myc ompany.com) the message goes
through.

There seems to be something wrong with the localhost smtp server but I
can't figure out what.
This is the code snippet I used for that test.

Dim mail As New System.Web.Mail .MailMessage()

mail.To = "bd*****@sgiims .com"

mail.From = "bd*****@sgiims .com"

mail.Subject = "this is a test email."

mail.Body = "this is my test email body"

SmtpMail.SmtpSe rver = "mail.mycompany .com" 'This works OK but localhost
does not

Try

SmtpMail.Send(m ail)

Catch ex As Exception

MsgBox(ex.Messa ge)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uj******** ******@TK2MSFTN GP04.phx.gbl...
>Robert,

Normaly you get tons of links to this website, therefore I gave you my
first thought the problem was.

http://www.systemwebmail.com/

I hope this helps,

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:uF******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was:
5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin
from another machine on the LAN and I think maybe this is a security
issue, where I have to specify an SMTP server name, username and
password, but I can't find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu****** ********@TK2MSF TNGP02.phx.gbl. ..
Robert,

First of all do you need to set IIS as SMTP server, that is not
standard, you can use the Microsoft tab in the add programs config for
that.

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc***** *********@TK2MS FTNGP02.phx.gbl ...
Dim message As New MailMessage("my ****@mydomain.c om",
"my****@myd omain.com", "Test", "Test")
>
Dim emailClient As New SmtpClient("loc alhost")
>
emailClient .Send(message)
>
The IIS server is running on the local machine.
>
What am I missing to make this work reliably?
>
Thanks for any help
>
Bob
>
>
>
>




Nov 5 '06 #7
Yes Cor I tried that too. But just for the heck of it I tried that again to
confirm. I used either 127.0.0.1 as the host address or 192.168.1.163.
Neither of them worked. My VERY strong suspicion is that I have something
wrong with the smtp server on this computer running under framework 2. I
recall trying to use this before I had framework 2 installed with Vs2003 and
framework with framework1.1 and system.web.mail and it worked fine. Now in
Vs2005 and fraemwork2 I am having these problems. In the last two tests I
did I found that the email messages got created in the Drop directory (two
..eml files with the date and time stamp of the time of the test). I then
retried setting the host to mail.mydomain.c om and also sending a message.
That did not seem to work this time either.
Yesterday I had unistalled and reintalled the smtp server on this computer
and enabled logging.
Attached you will find a log file for today (zipped format) the test entrie
are the last few. I'm trying to figure out what the other log entries (the
hotmail ones) for today are, they just seem to repeat and I don't know why.
Also I'm behind an ISA 2004 firewall, but I'm picking up and sending my
email messages to and from my hosted outside accounts via outlook 2003 OK
and it worked fine under framework 1.1 on te host. I also double checked and
made sure to add a rule to the ISA server to allow SMTP on Port 25 to be
used outbound between the protected networks on my lan and the outside
network, although I think its redundant.

I wonder if there is any testing tools that I can use to test the workings
of my local smtp virtual server.

Thanks for your help
Bob

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uL******** ******@TK2MSFTN GP03.phx.gbl...
Robert,

Did you already try the IP address of your local computer?

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>I also tested to use localhost using system.web.mail instead of the new
system.net.ma il
I get an exception : the transport could not connect to the host when
using localhost as the smtp server. When using my mail server outside of
my lan where I am normally hosted(mail.myc ompany.com) the message goes
through.

There seems to be something wrong with the localhost smtp server but I
can't figure out what.
This is the code snippet I used for that test.

Dim mail As New System.Web.Mail .MailMessage()

mail.To = "bd*****@sgiims .com"

mail.From = "bd*****@sgiims .com"

mail.Subject = "this is a test email."

mail.Body = "this is my test email body"

SmtpMail.SmtpS erver = "mail.mycompany .com" 'This works OK but localhost
does not

Try

SmtpMail.Send( mail)

Catch ex As Exception

MsgBox(ex.Mess age)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uj******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Robert,

Normaly you get tons of links to this website, therefore I gave you my
first thought the problem was.

http://www.systemwebmail.com/

I hope this helps,

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:uF****** ********@TK2MSF TNGP04.phx.gbl. ..
Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was:
5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin
from another machine on the LAN and I think maybe this is a security
issue, where I have to specify an SMTP server name, username and
password, but I can't find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu***** *********@TK2MS FTNGP02.phx.gbl ...
Robert,
>
First of all do you need to set IIS as SMTP server, that is not
standard, you can use the Microsoft tab in the add programs config for
that.
>
Cor
>
"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc**** **********@TK2M SFTNGP02.phx.gb l...
>Dim message As New MailMessage("my ****@mydomain.c om",
>"my****@my domain.com", "Test", "Test")
>>
>Dim emailClient As New SmtpClient("loc alhost")
>>
>emailClien t.Send(message)
>>
>The IIS server is running on the local machine.
>>
>What am I missing to make this work reliably?
>>
>Thanks for any help
>>
>Bob
>>
>>
>>
>>
>
>




Nov 6 '06 #8
I found a document showing how to use telnet to test my virtual server
kb/286421.
I worked through it OK although I found that to get 250 responses to
everything I had to use for the FROM property of the message
myloggedinUsern am@MylanDomainN ame
BUT during that test the message did not end up in the destination mailbox.
Trying again
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uL******** ******@TK2MSFTN GP03.phx.gbl...
Robert,

Did you already try the IP address of your local computer?

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>>I also tested to use localhost using system.web.mail instead of the new
system.net.ma il
I get an exception : the transport could not connect to the host when
using localhost as the smtp server. When using my mail server outside of
my lan where I am normally hosted(mail.myc ompany.com) the message goes
through.

There seems to be something wrong with the localhost smtp server but I
can't figure out what.
This is the code snippet I used for that test.

Dim mail As New System.Web.Mail .MailMessage()

mail.To = "bd*****@sgiims .com"

mail.From = "bd*****@sgiims .com"

mail.Subject = "this is a test email."

mail.Body = "this is my test email body"

SmtpMail.SmtpS erver = "mail.mycompany .com" 'This works OK but localhost
does not

Try

SmtpMail.Send( mail)

Catch ex As Exception

MsgBox(ex.Mess age)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:uj******* *******@TK2MSFT NGP04.phx.gbl.. .
>>Robert,

Normaly you get tons of links to this website, therefore I gave you my
first thought the problem was.

http://www.systemwebmail.com/

I hope this helps,

Cor

"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:uF****** ********@TK2MSF TNGP04.phx.gbl. ..
Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was:
5.7.1
Unable to relay for my****@mydomain .com
The smtp server is localhost.
The SMTP service is running on the local machine.

I was working the local machine where the app was residing via Radmin
from another machine on the LAN and I think maybe this is a security
issue, where I have to specify an SMTP server name, username and
password, but I can't find any info on how to code this.
Regards,
Bob
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:eu***** *********@TK2MS FTNGP02.phx.gbl ...
Robert,
>
First of all do you need to set IIS as SMTP server, that is not
standard, you can use the Microsoft tab in the add programs config for
that.
>
Cor
>
"Robert Dufour" <bd*****@sgiims .comschreef in bericht
news:Oc**** **********@TK2M SFTNGP02.phx.gb l...
>Dim message As New MailMessage("my ****@mydomain.c om",
>"my****@my domain.com", "Test", "Test")
>>
>Dim emailClient As New SmtpClient("loc alhost")
>>
>emailClien t.Send(message)
>>
>The IIS server is running on the local machine.
>>
>What am I missing to make this work reliably?
>>
>Thanks for any help
>>
>Bob
>>
>>
>>
>>
>
>




Nov 6 '06 #9

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

Similar topics

3
4080
by: James M. Luongo | last post by:
Hello, I am having problems with the mail() function, but I don't know what the problems are. Here is a snippet of code: $to = "jmluongo@comcast.net"; $from = "Gallery@gafok.com"; $subject = "Gallery Comment";
1
1140
by: Daniel | last post by:
Before writing a code to send a mail using asp.net, what steps have to be taken Like do some configuration ? coz i'm new to .Net your help will be appreciated. Daniel.
2
2391
by: Jim | last post by:
Tried a search, but didn't find quite what I was looking for. Situation: Have a VBA code process, tapping CDOSYS to send e-mail from Access, attaching an Excel spreadsheet, to a given list of e-mail addresses. Process used to work flawlessly. Now, corporate IT has upgraded the desktop anti-virus engines to McAfee 8.0i, which is blocking attempts at Port 25. If I turn off the port blocking, the process works as expected. IT is
1
1481
by: Bob | last post by:
Vs2005 - Framework2. Just to let all of you know. I have found that I can not use an application to send e-mails using the system,net.mail namespace while Outlook express is opened on the same machine from which my program is trying to send an e-mail using smtp mail set to the same smtp server account as the currently selected outlook mail account. (code snippet follows at end) the application just does not send e-mail and no exception is...
6
4900
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of the html page controls the form fields that are required. It doesn't function like it's supposed to and I can leave all the fields blank and it still submits the form. Also I can't get it to transfer the file in the upload section. The file name...
9
1361
by: william | last post by:
You guys are a great resource for learners such as I. I have seen the way that you go over and above in explaining even the most mudane things to beginners, and I think it is a great thing that you do here. I only hope that you can help me understand how a certain type of application works. I loaded an app that filters out spam (as it puts it) "before it hits your inbox". Now, how does this work? It changed my incoming and outgoing...
3
1526
by: 5070707 | last post by:
Hi all! I have a small form created with VS2005 (Visual Basic) on that form i have 5 text boxes and 4 combo boxes. (the 4 combo boxes are data bind to an sql 2000 DB) i'v created a button and used an onclick snippet for sending email. (it works :) ) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EmailSubmitBTN.Click
12
1727
by: pedagani | last post by:
Dear comp.lang.c++, Could you make this snippet more efficient? As you see I have too many variables introduced in the code. //Read set of integers from a file on line by line basis in a STL set //fp is pre-defined for(;!fp.eof();) { string linestr;
0
9521
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
10107
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
9945
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
9900
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
8768
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
7324
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...
0
6599
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5214
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2733
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.