如何通过自己的系统或项目发送电子邮件和SMS [英] How send the email and SMS via your own system or project

查看:152
本文介绍了如何通过自己的系统或项目发送电子邮件和SMS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,:)
谁能帮助我如何通过您自己的VB.NET或ASP.NET项目的代理服务器发送SMS和电子邮件...

您可以发送与我的东西有关的任何文章..
谢谢..

Hi you All, :)
Can anybody help me how to send the SMS and email via your own proxy server of VB.NET or ASP.NET project ...

you can send any article related to my stuff ..
Thank you..

推荐答案

请参阅以下链接:
使用.NET发送SMS [通过asp.net发送SMS和EMAIL [ ^ ]
在ASP.NET中将SMS发送到移动设备 [ ^ ]
See these links:
Sending SMS using .NET[^]
Sending SMS and EMAIL via asp.net[^]
Sending SMS to a mobile in ASP.NET[^]


导入System.Net
导入System.Net.Mail
导入System.Net.Mime

-------------------------------------
私人订阅发件人(ByVal来自为字符串,ByVal显示名称为字符串,ByVal发送至字符串,ByVal消息为字符串,ByVal主题为字符串,ByVal密码为字符串,ByVal附加为字符串)
使用mailMessage作为新MailMessage(New MailAddress(SendTo),New MailAddress(SendTo))
mailMessage.Body =消息
mailMessage.Subject =主题
试试
将SmtpServer调暗为新的SmtpClient()
SmtpServer.Credentials =新的System.Net.NetworkCredential(发件人,密码)
SmtpServer.Port = 587

Dim MS()As String = From.ToString.Split("@")
昏暗的MailServer()作为字符串= MS(1).ToString.Split(.")
选择案例UCase(MailServer(0))
大小写为="GMAIL"
SmtpServer.Host ="smtp.gmail.com"
SmtpServer.EnableSsl = True
大小写为="YAHOO"
SmtpServer.Host ="smtp.mail.yahoo.com"
SmtpServer.EnableSsl = False
大小写为="AOL"
SmtpServer.Host ="smtp.aol.com"
SmtpServer.EnableSsl = False
大小写="LIVE"
SmtpServer.Credentials =新的System.Net.NetworkCredential(发件人,密码)
SmtpServer.Host ="smtp.live.com"
SmtpServer.EnableSsl = True
结束选择

mail =新MailMessage()
Dim addr()As String = SendTo.Split(,")
mail.From =新MailAddress(发件人,DisplayName,System.Text.Encoding.UTF8)
昏暗的我作为字节
对于i = 0要加长-1
mail.To.Add(addr(i))
接下来我
mail.Subject =主题
mail.Body =消息
mail.BodyEncoding = System.Text.Encoding.UTF7
如果为Attach.Length<> 0然后
mail.Attachments.Add(新附件(附件))
如果结束
mail.IsBodyHtml = True
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
mail.ReplyTo =新的MailAddress(SendTo)
SmtpServer.Send(邮件)
异常捕获
MessageBox.Show(例如,Message,"EMail",MessageBoxButtons.OK,MessageBoxIcon.Exclamation)
结束尝试
最终使用
结束Sub
Imports System.Net
Imports System.Net.Mail
Imports System.Net.Mime

-------------------------------------
Private Sub Sender(ByVal From As String, ByVal DisplayName As String, ByVal SendTo As String, ByVal Message As String, ByVal Subject As String, ByVal Password As String, ByVal Attach As String)
Using mailMessage As New MailMessage(New MailAddress(SendTo), New MailAddress(SendTo))
mailMessage.Body = Message
mailMessage.Subject = Subject
Try
Dim SmtpServer As New SmtpClient()
SmtpServer.Credentials = New System.Net.NetworkCredential(From, Password)
SmtpServer.Port = 587

Dim MS() As String = From.ToString.Split("@")
Dim MailServer() As String = MS(1).ToString.Split(".")
Select Case UCase(MailServer(0))
Case Is = "GMAIL"
SmtpServer.Host = "smtp.gmail.com"
SmtpServer.EnableSsl = True
Case Is = "YAHOO"
SmtpServer.Host = "smtp.mail.yahoo.com"
SmtpServer.EnableSsl = False
Case Is = "AOL"
SmtpServer.Host = "smtp.aol.com"
SmtpServer.EnableSsl = False
Case Is = "LIVE"
SmtpServer.Credentials = New System.Net.NetworkCredential(From, Password)
SmtpServer.Host = "smtp.live.com"
SmtpServer.EnableSsl = True
End Select

mail = New MailMessage()
Dim addr() As String = SendTo.Split(",")
mail.From = New MailAddress(From, DisplayName, System.Text.Encoding.UTF8)
Dim i As Byte
For i = 0 To addr.Length - 1
mail.To.Add(addr(i))
Next i
mail.Subject = Subject
mail.Body = Message
mail.BodyEncoding = System.Text.Encoding.UTF7
If Attach.Length <> 0 Then
mail.Attachments.Add(New Attachment(Attach))
End If
mail.IsBodyHtml = True
mail.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure
mail.ReplyTo = New MailAddress(SendTo)
SmtpServer.Send(mail)
Catch ex As Exception
MessageBox.Show(ex.Message, "EMail", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Try
End Using
End Sub


您是否尝试过在互联网上搜索此内容.
我搜索了VB.Net和短信,并获得了大量结果.

[
Did you try searching on the internet for this.
I did a search for VB.Net and sms and got tons of results.

This[^] was the first hit.


这篇关于如何通过自己的系统或项目发送电子邮件和SMS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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