Sending Multiple Emails At Once

原创 2004年08月14日 16:30:00
Just like setting up emailing from a form, in general, is not difficult, neither is sending emails to multiple people at the same time. First, we need to dimension a variable called 'MyVar': to hold all the email addresses in a string:
Dim MyVar as String
In inline coding, this would be placed inside the script tag, but outside any Sub or Function.

Next we need to set up the BCC field, grabbing all the emails from a database field called (surprise!) 'email':

Dim MySQL as string = "Select email from yourTableName"
Dim MyConn As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("UrAppString"))
Dim objDR as SQLDataReader
Dim Cmd as New SQLCommand(MySQL, MyConn)
MyConn.Open()
objDR=Cmd.ExecuteReader(system.data.CommandBehavior.CloseConnection)
MyVar=""
While objDR.Read()
	MyVar+=objDR("email")& ";"
End While
MyVar=MyVar.substring(0,(MyVar.Length-1))
The last line merely removes the semi-colon from the end that will naturally be placed there due to the line inside the While section.

You might want to check out another Tutorial here, called 'Emailing Form Results'. It goes over much of this next section also.

Dim objEmail as New MailMessage
objEmail.To="News@YourDomain.com"
objEmail.FROM="You@YourDomain.com"
objEmail.BCC=MyVar
objEmail.SUBJECT="This is my Subject"
objEmail.Body="Put text or a variable which represents the text - here"
objEmail.BodyFormat = MailFormat.Text
SmtpMail.SmtpServer ="mail.YourDomain.com"
SmtpMail.Send(objEmail)
The main sections that needs addressing here are the BCC field, the BODY field, and the TO field. For most, the TO field will be fairly trivial. You don't need any of the people in the email addresses for this one. I usually use a mail back to me, in order to be sure the email actually went out. In the BCC field, you see that the list of emails in the 'MyVar' variable goes here, without double quotes surrounding it, since it's a variable and not an explicit email address. The same goes for the BODY section. If you wanted to define a section of text, and assign it to a variable, before this block of code, then, you would merely put the variable name there, without double quotes. Naturally, the SMTP server is important, since that's the mail server which you assign to send the emails out.

Hopefully, this takes a little mystery out of the whole 'sending multiple emails at the same time' scenario.

spark编程python实例

spark编程python实例ValueError: Cannot run multiple SparkContexts at once; existing SparkContext(app=PySp...
  • dream_an
  • dream_an
  • 2016年07月17日 23:51
  • 10406

Kafka delivery保证(kafka消息投递保证)

有这么几种可能的delivery guarantee: At most once 消息可能会丢,但绝不会重复传输At least one 消息绝不会丢,但可能会重复传输Exactly once 每...
  • lizhitao
  • lizhitao
  • 2015年03月11日 15:22
  • 4201

kafka学习之路(三)——高级

设计原理 kafka的设计初衷是希望作为一个统一的信息收集平台,能够实时的收集反馈信息,并需要能够支撑较大的数据量,且具备良好的容错能力. 持久性 kafka使用文件存储消息,这就直接决定kafka在...
  • tanggao1314
  • tanggao1314
  • 2016年07月17日 21:34
  • 5051

Lenka - Everything at once的LRC歌詞

  • 2013年05月19日 10:05
  • 2KB
  • 下载

storm是如何保证at least once语义的

storm是通过什么机制来保证消息至少处理一次的语义的
  • gsky1986
  • gsky1986
  • 2015年07月21日 12:22
  • 3517

storm是如何保证at least once语义的

问题导读 1.spout、bolt、acker的关系是什么? 2.storm如何如何追踪消息(tuple)的处理? 3.2.storm示例说明什么问题? 背景 本篇看看s...
  • dub_lys
  • dub_lys
  • 2015年07月24日 13:57
  • 337

Multiple annotations found at this line

本篇 eclipse Multiple annotations found at this line错误,eclipse开发过程中,一些XML配置文件会报错,但是这些其实不是错,飘红的原因是因为ec...
  • Duqian94
  • Duqian94
  • 2016年09月12日 11:55
  • 430

Eclipse/MyEclipse的web项目中的js文件报Multiple markers at this line - Missing semicolon时的解决方法

1.MyEclipse MyEclipse的web项目中的js文件报Multiple markers at this line - Missing semicolon时,是由于还没有告诉myecli...
  • qq_22260641
  • qq_22260641
  • 2017年03月03日 10:01
  • 1125

Multiple markers at this line @Override的解决方法

使用Eclipse 进行项目开发,在实现类中的方法前面如果添加@Override就提示“Multiple markers at this line”的错误,问题描述如下    Multiple ...
  • wd4java
  • wd4java
  • 2015年06月15日 10:09
  • 848

At least one JAR was scanned for TLDs yet contained no TLDs.&Multiple bindings were found

At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger fo...
  • haifengyouxi
  • haifengyouxi
  • 2014年01月03日 16:38
  • 1993
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:Sending Multiple Emails At Once
举报原因:
原因补充:

(最多只允许输入30个字)