如何在VB.NET中发送电子邮件 [英] how to send Email in VB.NET

查看:114
本文介绍了如何在VB.NET中发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用VB.NET(使用导入的system.web.mail)在我的应用程序上发送电子邮件.

我的要求是我可以使用任何邮件帐户将电子邮件发送到任何邮件地址.

例如:
我使用主机:abc.com.vn
我的邮件:
来自tea@yahoo.com.vn
至:tea12abc.com.vn
主题:tesst发送邮件
身体:你好茶.

希望大家能帮助我解决这个问题
谢谢.

how to send a email on my application using VB.NET(using imports system.web.mail).

my requirement is I can use any mail account to send a email to any mail address.

for example:
I use host: abc.com.vn
my mail:
from tea@yahoo.com.vn
To: tea12abc.com.vn
subject: tesst send mail
body: hello tea.

I hope that everybody will help me resolve this problem
thanks.

推荐答案

请参见此处 [ ^ ].

如果您在互联网上进行搜索,则会发现更多信息.
See here[^].

If you do a search on the internet, you will find more information.


..尝试此一个
这是.NET的邮件组件
此处:
http://www.rebex.net/mail.net/
..try this one
this is a Mail Component for .NET
here:
http://www.rebex.net/mail.net/


要在VB.NET中发送电子邮件,

导入System.Web.Mail

您可以通过两种方式调用Send方法.

1.通过传递MailMessage作为参数


Hi To send email in VB.NET,

Imports System.Web.Mail

You can call the Send method in two ways.

1. By passing MailMessage as a parameter


public static void Send(MailMessage).
Here MailMessage is a class.
Private mailMsg As MailMessage = New MailMessage()
Private mailMsg.From = from@fromServer.com
Private mailMsg.To = to@toServer.com
Private mailMsg.Cc = cc@ccServer.com"
Private mailMsg.Bcc = bcc@bccServer.com
Private mailMsg.Subject = "SubjectOfTheMailString"
Private mailMsg.Body = "BodyOfTheMailString"
SmtpMail.Send(mailMsg).


2.直接方法.


2. Direct method.

public static void Send(String from, String to, String subject, String messageText).



示例:



Example:

SmtpMail.Send("mcb@abc.com", "webmaster@def.com", "Subject", "Message body").


问候
明尼苏达州


Regards
Sreyas MN


这篇关于如何在VB.NET中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆