c# - When mail is triggered getting blank fields in mail -
c# - When mail is triggered getting blank fields in mail -
below code sending mail.iam not getting error or exception when mail service triggered iam getting blank fields part name,location name , partner code. partner name displayed.
if (objuser.usermasterid == 0) { objuser.functionalityid = 10; //partner creation dtpartnermaildetails = usermasterbl.getpartnermaildetails(objuser); if (dtpartnermaildetails.rows.count > 0) { objuser.regionname = dtpartnermaildetails.rows[0]["regionname"].tostring(); objuser.locationname = dtpartnermaildetails.rows[0]["locationname"].tostring(); objuser.partnercode = dtpartnermaildetails.rows[0]["partnercode"].tostring(); objuser.partnername = dtpartnermaildetails.rows[0]["partnername"].tostring(); } dtmaildetails = usermasterbl.getmaildetails(objuser); if (dtmaildetails.rows.count > 0) { string strmailfrom = "wiproimscertificationportal@wipro.com"; string tomailids = dtmaildetails.rows[0]["tomailids"].tostring(); string ccmailids = dtmaildetails.rows[0]["ccmailids"].tostring(); /* string part = dtpartnermaildetails.rows[0]["regionname"].tostring(); string location = dtpartnermaildetails.rows[0]["locationname"].tostring(); string partnercode = dtpartnermaildetails.rows[0]["partnercode"].tostring(); string partnername = dtpartnermaildetails.rows[0]["partnername"].tostring();*/ string part = objuser.regionname; string location = objuser.locationname; string partnercode = objuser.partnercode; string partnername = objuser.partnername; //string partnercodeauto = objuser.partnercodeid; string strmailbody = "<html><body><font face='verdana' size=2 color=#0e6192>"; strmailbody += "dear administrator " + "<br/><br/>"; strmailbody += "kindly approve below request, created " + objuser.partnername + "<br/> <br/>"; strmailbody += "<br/><br/>"; strmailbody += "<table border=1><tr><td><b>sl no </b></td><td><b>region</b></td><td><b>location</b></td><td><b>partner name</b></td><td><b>partner code</b></td>"; strmailbody += "<tr><td>1 </td><td>" + part + "</td><td> " + location + " </td><td>" + partnername + " </td><td>" + partnercode + " </td></tr></table>"; strmailbody += "<br/><br/>"; strmailbody += "</body></html>"; strmailbody += "best regards" + "<br/>" + " ims team"; strmailbody += "<br/><br/>"; strmailbody += "disclaimer: scheme generated mail. please not reply mail. queries, please log phone call in https://serviceconnect.wipro.com <br/>"; string strmailsubject = "partner add-on " + objuser.partnercode + ""; helper.sendmail(strmailfrom, tomailids, strmailsubject, strmailbody, ccmailids, null, null); }
data layer code:
public static datatable getpartnermaildetails(usermasterol objuser) { if (objuser == null) { throw new argumentnullexception("objuser"); } datatable dtgetpartnermaildetails = new datatable(); dtgetpartnermaildetails.locale = cultureinfo.invariantculture; seek { dbcommand dbcmd = dataaccessbase.database.getstoredproccommand(constants.getpartnercreationmaildetails); dataaccessbase.database.addinparameter(dbcmd, "@partnercode", dbtype.string, objuser.partnercode); dtgetpartnermaildetails = dataaccessbase.database.executedataset(dbcmd).tables[0]; }
stored procedure:
alter procedure [dbo].[getpartnercreationmaildetails] ( @partnercode int ) begin set nocount on select rm.regionname,pm.partnercode,pm.partnername,lm.locationname partnermaster pm inner bring together regionmaster rm on rm.regionid=pm.regionid inner bring together locationmaster lm on lm.locationid=pm.locationid pm.partnercode=@partnercode end
try closing tr on line:
strmailbody += "<table border=1><tr><td><b>sl no </b></td><td><b>region</b></td><td><b>location</b></td><td><b>partner name</b></td><td><b>partner code</b></td>";
it should be
strmailbody += "<table border=1><tr><td><b>sl no </b></td><td><b>region</b></td><td><b>location</b></td><td><b>partner name</b></td><td><b>partner code</b></td></tr>";
c#
Comments
Post a Comment