473,394 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

This mail sending code snippet does not work

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

Dim emailClient As New SmtpClient("localhost")

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 4 '06 #1
8 1979
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**************@TK2MSFTNGP02.phx.gbl...
Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")

Dim emailClient As New SmtpClient("localhost")

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 #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**************@TK2MSFTNGP02.phx.gbl...
Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")

Dim emailClient As New SmtpClient("localhost")

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 #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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl...
>Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")

Dim emailClient As New SmtpClient("localhost")

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 #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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl...
>>Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")

Dim emailClient As New SmtpClient("localhost")

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 #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.mycompany.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.SmtpServer = "mail.mycompany.com" 'This works OK but localhost does
not

Try

SmtpMail.Send(mail)

Catch ex As Exception

MsgBox(ex.Message)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uj**************@TK2MSFTNGP04.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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl...
Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")

Dim emailClient As New SmtpClient("localhost")

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****************@TK2MSFTNGP04.phx.gbl...
>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.mycompany.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.SmtpServer = "mail.mycompany.com" 'This works OK but localhost
does not

Try

SmtpMail.Send(mail)

Catch ex As Exception

MsgBox(ex.Message)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uj**************@TK2MSFTNGP04.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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl...
Dim message As New MailMessage("my****@mydomain.com",
"my****@mydomain.com", "Test", "Test")
>
Dim emailClient As New SmtpClient("localhost")
>
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.com 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**************@TK2MSFTNGP03.phx.gbl...
Robert,

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

Cor

"Robert Dufour" <bd*****@sgiims.comschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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.mycompany.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.SmtpServer = "mail.mycompany.com" 'This works OK but localhost
does not

Try

SmtpMail.Send(mail)

Catch ex As Exception

MsgBox(ex.Message)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uj**************@TK2MSFTNGP04.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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl.. .
>Dim message As New MailMessage("my****@mydomain.com",
>"my****@mydomain.com", "Test", "Test")
>>
>Dim emailClient As New SmtpClient("localhost")
>>
>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 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
myloggedinUsernam@MylanDomainName
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**************@TK2MSFTNGP03.phx.gbl...
Robert,

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

Cor

"Robert Dufour" <bd*****@sgiims.comschreef in bericht
news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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.mycompany.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.SmtpServer = "mail.mycompany.com" 'This works OK but localhost
does not

Try

SmtpMail.Send(mail)

Catch ex As Exception

MsgBox(ex.Message)

End Try


Thanks for your help.
Bob
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:uj**************@TK2MSFTNGP04.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**************@TK2MSFTNGP04.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**************@TK2MSFTNGP02.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**************@TK2MSFTNGP02.phx.gbl.. .
>Dim message As New MailMessage("my****@mydomain.com",
>"my****@mydomain.com", "Test", "Test")
>>
>Dim emailClient As New SmtpClient("localhost")
>>
>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 6 '06 #9

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

Similar topics

3
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";...
1
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
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...
1
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...
6
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...
9
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...
3
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...
12
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...

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.