|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
This mail sending code snippet does not workDim message As New MailMessage("mym***@mydomain.com", "mym***@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 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 Show quoteHide quote "Robert Dufour" <bduf***@sgiims.com> schreef in bericht news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... > Dim message As New MailMessage("mym***@mydomain.com", > "mym***@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 > > > > Hi Cor
It was already set. I'm getting back error Mailbox unavailable. The server response was: 5.7.1 Unable to relay for myn***@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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht > news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >> Dim message As New MailMessage("mym***@mydomain.com", >> "mym***@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 >> >> >> >> > > 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 Show quoteHide quote "Robert Dufour" <bduf***@sgiims.com> schreef in bericht news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message > news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>> Dim message As New MailMessage("mym***@mydomain.com", >>> "mym***@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 >>> >>> >>> >>> >> >> > > Hi Cor.
I am using the framework 2 so I would need to uses system.net.mail instead of system.web.mail I think. In any case I looked it up went to the framework2 documentation and found a way to see the inner exception What I keep getting as inner exceptionn when trying to use localhost or 127.0.0.1 as the smtp server is System.net.mail.smtpexception:Failure sending mail--->Unable to read data from the transport connection: net_io_connectionclosed and the a bunch of at locations pointing to code in what I think is dll. see attached doc file for complete inner exception message. This is the code snippet with which I did the latest test. By the way, if I use my outside mail server name (mail.mycompany.com is where my accounts are hosted) instead of my localhost then the mail gets sent OK. But I have to write the code to use localhost for when I distribute it. Here's the snippet Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'create the mail message Dim mail As New MailMessage() 'set the addresses mail.From = New MailAddress("myn***@mydomain.com") mail.To.Add("myn***@mydomain.com") 'set the content mail.Subject = "This is a test email" mail.Body = "this is the body content of the email." 'send the message Dim smtp As New SmtpClient("127.0.0.1") Try smtp.Send(mail) Catch ex As Exception Dim ex2 As Exception = ex Dim errorMessage As String = String.Empty While Not (ex2 Is Nothing) errorMessage += ex2.ToString() ex2 = ex2.InnerException End While MsgBox(errorMessage) End Try End Sub Please note on this very same machine I have no problems accessing my network, doing my e-mail with outlook or outlook express, or using internet explorer to access the web. Thanks for your help Bob Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message [attached file: err.doc]news:ujn7MmOAHHA.1224@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" <bduf***@sgiims.com> schreef in bericht > news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message >> news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >>> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>>> Dim message As New MailMessage("mym***@mydomain.com", >>>> "mym***@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 >>>> >>>> >>>> >>>> >>> >>> >> >> > > 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 = "bduf***@sgiims.com" mail.From = "bduf***@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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:ujn7MmOAHHA.1224@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" <bduf***@sgiims.com> schreef in bericht > news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message >> news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >>> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>>> Dim message As New MailMessage("mym***@mydomain.com", >>>> "mym***@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 >>>> >>>> >>>> >>>> >>> >>> >> >> > > Robert,
Did you already try the IP address of your local computer? Cor Show quoteHide quote "Robert Dufour" <bduf***@sgiims.com> schreef in bericht news:%23aFz2UPAHHA.4864@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 = "bduf***@sgiims.com" > > mail.From = "bduf***@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]" <notmyfirstn***@planet.nl> wrote in message > news:ujn7MmOAHHA.1224@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" <bduf***@sgiims.com> schreef in bericht >> news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message >>> news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >>>> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>>>> Dim message As New MailMessage("mym***@mydomain.com", >>>>> "mym***@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 >>>>> >>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message [attached file: ex061106.zip]news:uL3IFrPAHHA.4472@TK2MSFTNGP03.phx.gbl... > Robert, > > Did you already try the IP address of your local computer? > > Cor > > "Robert Dufour" <bduf***@sgiims.com> schreef in bericht > news:%23aFz2UPAHHA.4864@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 = "bduf***@sgiims.com" >> >> mail.From = "bduf***@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]" <notmyfirstn***@planet.nl> wrote in message >> news:ujn7MmOAHHA.1224@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" <bduf***@sgiims.com> schreef in bericht >>> news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message >>>> news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >>>>> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>>>>> Dim message As New MailMessage("mym***@mydomain.com", >>>>>> "mym***@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 >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > 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 Show quoteHide quote "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message news:uL3IFrPAHHA.4472@TK2MSFTNGP03.phx.gbl... > Robert, > > Did you already try the IP address of your local computer? > > Cor > > "Robert Dufour" <bduf***@sgiims.com> schreef in bericht > news:%23aFz2UPAHHA.4864@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 = "bduf***@sgiims.com" >> >> mail.From = "bduf***@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]" <notmyfirstn***@planet.nl> wrote in message >> news:ujn7MmOAHHA.1224@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" <bduf***@sgiims.com> schreef in bericht >>> news:uFjuayNAHHA.3380@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 myn***@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]" <notmyfirstn***@planet.nl> wrote in message >>>> news:eugKNtKAHHA.1196@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" <bduf***@sgiims.com> schreef in bericht >>>>> news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... >>>>>> Dim message As New MailMessage("mym***@mydomain.com", >>>>>> "mym***@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 >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> >>> >>> >> >> > > I'm getting back error Mailbox unavailable. The server response was: 5.7.1
Unable to relay for myn***@mydomain.com The smtp server is localhost. The SMTP service is running on the local machine Show quoteHide quote "Robert Dufour" <bduf***@sgiims.com> wrote in message news:OcGqlgEAHHA.1196@TK2MSFTNGP02.phx.gbl... > Dim message As New MailMessage("mym***@mydomain.com", > "mym***@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 > > > >
incorrect string format
Altering a DBF File Merge/Synchronize XML Files [Regular Expression] (aaa AND bbb) OR (ccc AND ddd) Fundamental OOP inheritance question Accessing an arraylist from multiple forms. don't show error windows Unable to remove Beep on Alt+A Can reflection tell the base class of an object? Deleting Values from an XML node? |
|||||||||||||||||||||||