CnnStr="Provider=SQLOLEDB.1;Password=xxx;Persist Security Info=True;User ID=cpmsuser;Initial Catalog=aaUAT;Data Source=10.22.512.53" set con=CreateObJect("Adodb.Connection") set Rs=createObject("Adodb.Recordset") Dim myMail Dim strBody Dim Mailforperiod Mailforperiod="DEC-15" Set obj_fso = CreateObject("Scripting.FileSystemObject") con.Open CnnStr MyQuery="select replace([brknm],' ','_')+'.xls' file_name,* from broker_july with(nolock) where isnull(sent,0)=0 and isnull(category,'')='A'" Rs.Open MyQuery, con while not(Rs.Eof) Set objCDO = CreateObject("CDO.Message") schema = "http://schemas.microsoft.com/cdo/configuration/" With objCDO .To=rs("to") .CC=rs("CC") .From = "XYZ Company LTD.<XYZ.SERVICE@XVZ.com>" '.Subject = "Brokerage statement for the month of Mar 14" .Subject = "Agency Commission statement for the month of "& Mailforperiod strMailBody ="" strMailBody ="To"&vbLf strMailBody =strMailBody &""&trim(rs("nm"))&","&vbLf&vbLf&vbLf 'strMailBody =strMailBody &"Enclosed is the revised Brokerage statement for the month of Mar 14. The amount payable for Mar 14 is Rs."&rs("Commamt") &vbLf&vbLf strMailBody =strMailBody &"Enclosed is the Agency Commission statement for the month of "& Mailforperiod &". The amount payable for "& Mailforperiod &" is Rs."&rs("Commamt") &vbLf&vbLf 'strMailBody =strMailBody &"Policywise statement have also been enclosed for your reference. You are requested to raise a brokerage invoice along with service tax for brokerage disbursement and submit to our Sales manager or at our nearest branch office." &vbLf&vbLf strMailBody =strMailBody &"Policywise statement have also been enclosed for your reference."'Commission has been disbursed via Cheque/NEFT "&trim(rs("chqno"))&" on 29-Mar-2014." &vbLf&vbLf strMailBody =strMailBody &"Incase of any query please feel free to contact our Sales Manager servicing you."&vbLf&vbLf strMailBody =strMailBody &"Note: As a company policy, we are releasing brokerage only on premium cheque realization."&vbLf&vbLf strMailBody =strMailBody &"It is a system generated mail, please do not reply."&vbLf&vbLf&vbLf strMailBody =strMailBody &"Regards"&vbLf&vbLf&vbLf strMailBody =strMailBody &"XYZ Team"&vbLf&vbLf strMailBody =strMailBody & "This email and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies and the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this email is strictly prohibited and may be unlawful. The recipient acknowledges that XYZ General Insurance Company Limited, is unable to exercise control or ensure or guarantee the integrity of/over the contents of the information contained in email transmissions and further acknowledges that any views expressed in this message are those of the individual sender and no binding nature of the message shall be implied or assumed unless the sender does so expressly with due authority of XYZ General Insurance Company Limited." .textBody =strMailBody With .Configuration.Fields .Item (schema & "sendusing") = 2 .Item (schema & "smtpserver") ="10.49.11.41" .Item (schema & "smtpserverport") = 25 .Item (schema & "smtpauthenticate") = cdoBasic End With .Configuration.Fields.Update If obj_fso.fileExists("\\10.62.121.10\mahesh_scan\Mail\BrkFile\"&trim(rs("file_name")) ) then .AddAttachment "\\10.62.121.10\mahesh_scan\Mail\BrkFile\"&trim(rs("file_name")) .Send ' msgbox "hi" end if '.Send ' msgbox "hi1" End With If obj_fso.fileExists("\\10.62.121.10\mahesh_scan\Mail\BrkFile\"&trim(rs("file_name")) ) then str="Update broker_july set senton=getdate(), sent=1 where id="&rs("id") con.execute(str) end if wscript.sleep(800) rs.Movenext Wend msgbox "Send"
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)