Mail Function in vb.net
-
Hello Friends , How can we create mail Function (send mail) in window based application. Manu
this is a very simple way to do it (don't know if it will meet you expectations)
imports system.web.mail
...Dim obj As SmtpMail ' Variable which will send the mail
Dim Mailmsg As New MailMessage()
obj.SmtpServer = "server:relay.skynet.be"
Mailmsg.To = "test@test.be" 'the email adress to send to
Mailmsg.From = "\" & (sender) & "\ <" & (sendermail) & ">" '(sender) = the name to be displayed || (sendermail) = a valid email adress from wich to send
Mailmsg.BodyFormat = MailFormat.Text
Mailmsg.Subject = "example"
Mailmsg.Body = "example body"
obj.Send(Mailmsg)hope this helps
If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.
-
this is a very simple way to do it (don't know if it will meet you expectations)
imports system.web.mail
...Dim obj As SmtpMail ' Variable which will send the mail
Dim Mailmsg As New MailMessage()
obj.SmtpServer = "server:relay.skynet.be"
Mailmsg.To = "test@test.be" 'the email adress to send to
Mailmsg.From = "\" & (sender) & "\ <" & (sendermail) & ">" '(sender) = the name to be displayed || (sendermail) = a valid email adress from wich to send
Mailmsg.BodyFormat = MailFormat.Text
Mailmsg.Subject = "example"
Mailmsg.Body = "example body"
obj.Send(Mailmsg)hope this helps
If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.
-
Firstly thanks . Friend my problem is that whenever we are trying to imports system.web.mail in window form it give error namespace can not find . Manu
You have to add a reference System.Web and then add Imports System.Web.mail HTH
-
Firstly thanks . Friend my problem is that whenever we are trying to imports system.web.mail in window form it give error namespace can not find . Manu
like 'samerh' said add a reference to system.web you can find it on the '.net' tab or at 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.
-
like 'samerh' said add a reference to system.web you can find it on the '.net' tab or at 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll'
If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistaks.