By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,028 Members | 1,092 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,028 IT Pros & Developers. It's quick & easy.

Sending mail from page

P: n/a
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 = "ma*******@gmail.com"
myMessage.To = "ma*******@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
Nov 17 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"Zile" <bo******@yahoo.comwrote in message
news:ej**********@sunce.iskon.hr...
There is no error message! Only message that recomended is
System.Net.Mail.MailMessage instead System.Web.Mail.MailMessage.
Which is correct, since you're using v2.

http://www.systemnetmail.com
Compiling is ok, but messages is not sent. I changed myMessage.To
adresses, but nothing! How to fix it?
Well, firstly, you need to tell it where your mailserver is...

http://www.systemwebmail.com/faq/2.1.aspx
http://www.systemnetmail.com/faq/3.1.1.aspx
Nov 17 '06 #2

P: n/a
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("ma*******@gmail.com",
"ma*******@gmail.com")
mm.Subject = "Automatic sending mail"
mm.Body = "Success!"

Try
client.Send(mm)
Catch ex As Exception
' handle the error
End Try

Ken
-------------------
"Zile" <bo******@yahoo.comwrote in message
news:ej**********@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 = "ma*******@gmail.com"
myMessage.To = "ma*******@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


Nov 17 '06 #3

P: n/a
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?
Nov 17 '06 #4

P: n/a
"Zile" <bo******@yahoo.comwrote in message
news:ej**********@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?
Whichever one allows you to send emails from your local 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.
Nov 17 '06 #5

P: n/a
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 = "ma*******@gmail.com"
myMessage.To = "ma*******@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)

On Fri, 17 Nov 2006 12:27:07 +0100, "Zile" <bo******@yahoo.comwrote:
>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 = "ma*******@gmail.com"
myMessage.To = "ma*******@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
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 17 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.