|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Sending mail from pageI am trying to send mail from web page in asp.net 2.0/VB 2005:
Dim Poruka As New System.Web.Mail.MailMessage myMessage.From = "matema***@gmail.com" myMessage.To = "matema***@hotmail.com" myMessage.Subject = "Automatic sending mail" myMessage.Body = "Success!" Mail.SmtpMail.Send(myMessage) There is no error message! Only message that recomended is System.Net.Mail.MailMessage instead System.Web.Mail.MailMessage. Compiling is ok, but messages is not sent. I changed myMessage.To adresses, but nothing! How to fix it? Thanks Hi,
I do not think your smtp server is sending the message. You might want to connect to a smtp server to send them Dim client As New SmtpClient("mail.YourServer.com") client.Credentials = New Net.NetworkCredential("UserName", "YourPassword") Dim mm As New MailMessage("matema***@gmail.com", "matema***@gmail.com") mm.Subject = "Automatic sending mail" mm.Body = "Success!" Try client.Send(mm) Catch ex As Exception ' handle the error End Try Ken ------------------- Show quoteHide quote "Zile" <bozid***@yahoo.com> wrote in message news:ejk6a9$8ll$1@sunce.iskon.hr... >I am trying to send mail from web page in asp.net 2.0/VB 2005: > > Dim Poruka As New System.Web.Mail.MailMessage > > myMessage.From = "matema***@gmail.com" > myMessage.To = "matema***@hotmail.com" > myMessage.Subject = "Automatic sending mail" > myMessage.Body = "Success!" > Mail.SmtpMail.Send(myMessage) > > There is no error message! Only message that recomended is > System.Net.Mail.MailMessage instead System.Web.Mail.MailMessage. > Compiling is ok, but messages is not sent. I changed myMessage.To > adresses, but nothing! How to fix it? > > Thanks > > Again! Compile is ok, but mail is not comming. What can be problem? I am
running this aspx page on my local server on my computer it is not on web hosting account. Is this can be a problem? Which smtp server I must to put, from my web hosting account or from my outlook express if I am running aspx on my computer? "Zile" <bozid***@yahoo.com> wrote in message Whichever one allows you to send emails from your local computer.news:ejkald$jjf$1@sunce.iskon.hr... > Which smtp server I must to put, from my web hosting account or from my > outlook express if I am running aspx on my computer? E.g. my hosting service is hostinguk.net, and they allow web applications deployed on their servers to send outgoing email using their SMTP queue on relay.hostinguk.net. However, this will not work from my local machine because that SMTP queue will not recognise it as part of its internal network, otherwise they'd be inundated with spammers relaying email through their servers... Therefore, when I'm developing and testing from home, I need to use my ISP's SMTP queue, which is smtp.blueyonder.co.uk - at this point, the email can be sent because that SMTP queue recognises my machine as valid on their network because it has been assigned an IP address from their DHCP pool. Couple of things:
1) you must have access to a smtp server that can relay mail on your behalf. 2) Said smtp server must be configured to allow relay of email If you have established this you can modify your code as follows: myMessage.From = "matema***@gmail.com" myMessage.To = "matema***@hotmail.com" myMessage.Subject = "Automatic sending mail" myMessage.Body = "Success!" 'Replace mail.server.com with your smtp server SmtpMail.SmtpServer = "mail.server.com" SmtpMail.Send(Message) Show quoteHide quote On Fri, 17 Nov 2006 12:27:07 +0100, "Zile" <bozid***@yahoo.com> wrote: Bits.Bytes.>I am trying to send mail from web page in asp.net 2.0/VB 2005: > > Dim Poruka As New System.Web.Mail.MailMessage > > myMessage.From = "matema***@gmail.com" > myMessage.To = "matema***@hotmail.com" > myMessage.Subject = "Automatic sending mail" > myMessage.Body = "Success!" > Mail.SmtpMail.Send(myMessage) > >There is no error message! Only message that recomended is >System.Net.Mail.MailMessage instead System.Web.Mail.MailMessage. >Compiling is ok, but messages is not sent. I changed myMessage.To adresses, >but nothing! How to fix it? > >Thanks > -- http://bytes.thinkersroom.com |
|||||||||||||||||||||||