Sending Newsletters

Results 1 to 2 of 2

Thread: Sending Newsletters

  1. #1
    Join Date
    Dec 1969

    Default Sending Newsletters

    hello,<BR> I have to send Newsletter to a set of email addresses which i have in my database. how can i post those Newsletters at one stretch. can any one suggest me?<BR><BR>Thank you,<BR>Keerthi

  2. #2
    Join Date
    Dec 1969

    Default RE: Sending Newsletters

    function mail(From,Fromname,host,Address,repladdress,subjec t,body, Attachstr)<BR> Set Mailer = Server.CreateObject("Persits.MailSender")<BR> Mailer.From = From<BR> Mailer.Fromname = Fromname<BR> Mailer.Host = host<BR> Mailer.AddAddress address<BR> Mailer.AddReplyTo repladdress<BR> Mailer.Subject = subject<BR> Mailer.Body = body<BR> Attachstr = server.mappath(Attachstr)<BR> <BR> &#039str = "http://" & Request.ServerVariables("SERVER_NAME") & ""<BR> &#039str1 = str & Attachstr<BR> Mailer.AddAttachment Attachstr<BR> <BR> &#039Mailer.AddEmbeddedImage imge, "MyImage"<BR> &#039bline = "&#060;HTML&#062;&#060;BODY&#062;&#060;IMG SRC=cid:MyImage&#062;<BR>news letter&#060;/HTML&#062;"<BR> &#039Mailer.body = tline<BR> &#039Mailer.IsHTML = True<BR> &#039Mailer.AppendBodyFromFile str1<BR> <BR> Mailer.Send <BR> If Err &#060;&#062; 0 Then<BR> Response.Write "Error encountered: " & Err.Description<BR> End If<BR> Mailer.Reset<BR> end function <BR><BR>function ConnectForEmail()<BR><BR>&#039 *** SET CONNECTION AND GET EMP NAME AND EMAIL ******<BR> set conn = server.createobject("ADODB.Connection")<BR> set rs = server.createobject("ADODB.Recordset")<BR> dsnstr = DB_GetDSNStr()<BR> dsnstr<BR> <BR> "Select email,Fname from newsletter where datepart(month,dob) =datepart(month,getdate()) and datepart(day,dob) =datepart(day,getdate()) and email IS NOT NULL",conn,3,3<BR><BR> <BR> gStr = Getnewsletter()<BR> <BR><BR>&#039 *** IN LOOP SEND MAIL ONE BY ONE TO ALL <BR> <BR> do while not rs.EOF<BR><BR> response.write "RS:Email " & rs("email") & "<BR>" <BR> emailst= rs("email")<BR> empname = rs("Fname") <BR><BR>&#039 *** GET HTML FILE AND SEND MAIL. <BR> If (rs("email") &#060;&#062; "" or rs("email") &#060;&#062; NULL) Then<BR> GetAttachFileSendMail emailst,empname,gStr<BR> End If<BR> rs.movenext<BR> loop<BR> GetAttachFileSendMail "",empname,gStr<BR> rs.close<BR> set rs= nothing<BR> conn.close<BR> set conn= nothing<BR><BR>end function<BR><BR>function GetBirthdayGreeting()<BR><BR> file=server.mappath("/newsletter.txt")<BR> filetemp=server.mappath("/newsletter.txt")<BR><BR> Set fs = CreateObject("Scripting.FileSystemObject")<BR> Set fstemp = CreateObject("Scripting.FileSystemObject")<BR> <BR>&#039 **** OPEN RFILE FOR READ AND FILETEMPW FOR WRITE ***** <BR><BR> Set rfile = fs.OpenTextFile(file, 1, False)<BR> Set filetempw = fstemp.CreateTextFile(filetemp, true)<BR> <BR> counter=0<BR> flag = 0<BR><BR>&#039 **** READ LINE WITH IMAGENAME FROM READ FILE AND MARK IT WITH &#124 AND TRANSFER ALL DATA TO TEMP FILE. ***** <BR> Do while not rfile.AtEndOfStream <BR> counter=counter+1<BR> thisline=rfile.readline<BR> If flag = 0 Then<BR> If InStr(thisline, "&#124") = 0 Then<BR> sText = thisline<BR> thisline = thisline & "&#124"<BR> flag = 1<BR> End If<BR> End If<BR> filetempw.WriteLine(thisline) <BR> loop<BR> <BR> rfile.Close<BR> set rfile=nothing<BR> set fs=nothing<BR> <BR> filetempw.Close<BR> set filetempw=nothing<BR> set fstemp=nothing<BR><BR>&#039 **** AGAIN OPEN TEMP FILE IN READ AND IMAGEFILE WITH WRITE MODE TRANSFER ALL DATA FROM TEMP TO ORIGINAL FILE.***** <BR> counter = 0<BR> sflag = 0<BR> Set fs = CreateObject("Scripting.FileSystemObject")<BR> Set fstemp = CreateObject("Scripting.FileSystemObject")<BR><BR> Set rfile = fs.CreateTextFile(file, true)<BR> Set filetempw = fstemp.OpenTextFile(filetemp, 1, False)<BR> Do while not filetempw.AtEndOfStream <BR> counter=counter+1<BR> thisline=filetempw.readline<BR> <BR>&#039 **** BUT IF ALL IMAGE PATHS ARE ALREADY MARKED AS &#124 THEN REMOVE ALL &#124 AND MARK ONLY SELECTED AS &#124 AND THEN TRANSFER FROM TEMP TO ORIGINAL.***** <BR> If flag = 0 Then<BR> pos = InStr(thisline, "&#124")<BR> If pos &#060;&#062; 0 Then<BR> leftstr = Rtrim(mid(thisline,1,pos-1))<BR> If sflag = 0 Then<BR> sText = leftstr<BR> sflag = 1<BR> rfile.writeline(thisline)<BR> Else<BR> rfile.writeline(leftstr)<BR> End If<BR> Else<BR> rfile.writeline(thisline)<BR> End If<BR> else<BR> rfile.writeline(thisline)<BR> End If<BR> Loop<BR> rfile.Close<BR> set rfile=nothing<BR> set fs=nothing<BR><BR> filetempw.close<BR> set filetempw=nothing<BR> set fstemp=nothing<BR> GetBirthdayGreeting = sText<BR>End Function<BR><BR>Function GetAttachFileSendMail(mailaddr,name,str)<BR><BR> GreetPath = "http://" & Request.ServerVariables("SERVER_NAME") & ""<BR> str1 = GreetPath & str<BR><BR> filetemp=server.mappath("/silnet/Stats/BirthdayWish.html")<BR> Set fstemp = CreateObject("Scripting.FileSystemObject")<BR> Set filetempw = fstemp.CreateTextFile(filetemp, true)<BR><BR> Greetline = "&#060;HTML&#062;&#060;BODY&#062;&#060;center&#062 ;&#060;B&#062; Hi " & name<BR> Greetline = news & "&#060;P&#062; news letter<BR><BR> &#060;IMG src=&#039" & str1 & "&#039 &#062;&#060;/BODY&#062;&#060;/HTML&#062;"<BR><BR> filetempw.WriteLine(Greetline) <BR> <BR> filetempw.Close<BR> set filetempw=nothing<BR> set fstemp=nothing<BR> <BR> mail "","23.455.56.67",mailaddr","/stats/<BR>newletter.html"<BR>End Function<BR>%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts