Re: This mail sending code snippet does not work

Tech-Archive recommends: Fix windows errors by optimizing your registry



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 = "bdufour@xxxxxxxxxx"

mail.From = "bdufour@xxxxxxxxxx"

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]" <notmyfirstname@xxxxxxxxx> wrote in message
news:ujn7MmOAHHA.1224@xxxxxxxxxxxxxxxxxxxxxxx
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" <bdufour@xxxxxxxxxx> schreef in bericht
news:uFjuayNAHHA.3380@xxxxxxxxxxxxxxxxxxxxxxx
Hi Cor
It was already set.
I'm getting back error Mailbox unavailable. The server response was:
5.7.1
Unable to relay for myname@xxxxxxxxxxxx
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]" <notmyfirstname@xxxxxxxxx> wrote in message
news:eugKNtKAHHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
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" <bdufour@xxxxxxxxxx> schreef in bericht
news:OcGqlgEAHHA.1196@xxxxxxxxxxxxxxxxxxxxxxx
Dim message As New MailMessage("mymail@xxxxxxxxxxxx",
"mymail@xxxxxxxxxxxx", "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












.



Relevant Pages

  • Re: This mail sending code snippet does not work
    ... There seems to be something wrong with the localhost smtp server but I ... Catch ex As Exception ... I was working the local machine where the app was residing via Radmin ...
    (microsoft.public.dotnet.languages.vb)
  • RE: VB 2003, 0x80040213
    ... You will need an SMTP server you can relay through. ... server or smartrelay on them, and <localhost> will not find your ISP, since ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Sending mail from current user in Python
    ... so I'd rather stick with the standard smtplib if I can. ... >> smtplib needs an SMTP server to connect to. ... For unix systems, this is ... > I'd be very surprised if the typical SMTP server is localhost ...
    (comp.lang.python)
  • Re: sending email
    ... Are you running an SMTP server locally (on localhost)? ... MAIL FROM:anyone@domain.com (put brackets around the email addresses, ... If you do not get this email assuming you put your email address in the RCPT ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to send E-mail without an external SMTP server ?
    ... haven't found documents about how to use it after googleing. ... any examples of using smtpd? ... Do I have to setup a smtp server on my localhost? ...
    (comp.lang.python)