Sending of email!http://forums.asp.net/t/1414354.aspx/1?Sending+of+email+Thu, 30 Apr 2009 04:51:35 -040014143543111907http://forums.asp.net/p/1414354/3111907.aspx/1?Sending+of+email+Sending of email! <p>&nbsp;hey people..i need some help in solving this problem..i have no idea how to start this because i've not done this before..</p> <p>any help is appreciated.. :)</p> <p>i'm doing this IT Helpdesk system for my project.. <br> </p> <p>what i'm suppose to do now is : i have to auto generate an email everyday at 9am and 5pm to a supportstaff with the ticket details which status is not equal to close :) </p> <p>&nbsp;</p> <p>how do i start about doing this??</p> <p>please help..thanx!(: <br> </p> 2009-04-23T01:54:39-04:003111953http://forums.asp.net/p/1414354/3111953.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>Hi There,</p> <p>Have a look at this article. would give you guideline from where to start.</p> <p><a href="http://msdn.microsoft.com/en-us/magazine/cc163821.aspx">http://msdn.microsoft.com/en-us/magazine/cc163821.aspx</a>.</p> <p>Let meknow if you furthur help!</p> 2009-04-23T02:28:23-04:003111984http://forums.asp.net/p/1414354/3111984.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>write an window program e.g. and schedule it to run at the desired time</p> 2009-04-23T02:45:18-04:003112037http://forums.asp.net/p/1414354/3112037.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>window program??</p> <p>what's that?how do i start doing that??</p> <p>please help.. :( <br> </p> 2009-04-23T03:20:44-04:003112239http://forums.asp.net/p/1414354/3112239.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>For an article on sending mail check out this site:</p> <p><a href="http://www.systemnetmail.com/" target="_blank">http://www.systemnetmail.com</a></p> <p>A windows form is an application like Word or Excel.<br> </p> 2009-04-23T05:29:18-04:003112263http://forums.asp.net/p/1414354/3112263.aspx/1?Re+Sending+of+email+Re: Sending of email! <p></p> <blockquote><span class="icon-blockquote"></span> <h4>BabyAngel</h4> &lt;div id=ctl00_ctl00_bcr_bcr_PostForm__QuoteText&gt; <p>window program??</p> <p>what's that?how do i start doing that??</p> <p>please help.. :( <br> </p> &lt;/div&gt; <p></p> </blockquote> <p></p> <p>if SQL server database is involved in your case then its very easy without any program just write a query to send emails and schedule it using job schedular Read my article</p> <p><a href="http://www.aspsnippets.com/post/2009/03/08/Automated-Email-Notifications-using-SQL-Server-Job-Schedular.aspx">http://www.aspsnippets.com/post/2009/03/08/Automated-Email-Notifications-using-SQL-Server-Job-Schedular.aspx</a></p> 2009-04-23T05:44:45-04:003112308http://forums.asp.net/p/1414354/3112308.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>&nbsp;hey mudassarkhan..thanx for replying..your post seems quite useful..i just want to check if its possible to do this without using stored procedures??because i'm not using stored procedures for my project.. :)<br> </p> 2009-04-23T06:02:29-04:003112316http://forums.asp.net/p/1414354/3112316.aspx/1?Re+Sending+of+email+Re: Sending of email! <p></p> <blockquote><span class="icon-blockquote"></span> <h4>BabyAngel</h4> hey mudassarkhan..thanx for replying..your post seems quite useful..i just want to check if its possible to do this without using stored procedures??because i'm not using stored procedures for my project.. :)<br> </blockquote> <p></p> <p>&nbsp;</p> <p>Yes definately you can schedule your query too</p> 2009-04-23T06:08:08-04:003112342http://forums.asp.net/p/1414354/3112342.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>&nbsp;i'm so sorry,,</p> <p>but i need your help in this..</p> <p>how do i schedule my query to this?? <br> </p> 2009-04-23T06:20:43-04:003112357http://forums.asp.net/p/1414354/3112357.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>In the step 4&nbsp;in my article just paste your query instead of stored proc</p> 2009-04-23T06:26:35-04:003112391http://forums.asp.net/p/1414354/3112391.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>make sure you login as an administrator,</p> <p>expand your server name, </p> <p>expand sql server agent, </p> <p>right click on job and new job</p> <p>p.s. i pm u </p> 2009-04-23T06:36:24-04:003112534http://forums.asp.net/p/1414354/3112534.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>under general: enter Name &amp; Description to what ever you like<br> under stpes: clilck on New, general: enter Step Name, choose the Database, enter the SQL command e.g what is provided in the mudass link, parse the quesry make sure correct, advanced: choose on success action, i'll chose Quit the job reporting success and set retry attemps if you want to, OK<br> under schedules: enter a name, and select what ever appropriate, OK.</p> 2009-04-23T07:20:44-04:003112602http://forums.asp.net/p/1414354/3112602.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>&nbsp;am i suppose to put this in the command??</p> <p>Select * from ITHelpdesk.dbo.tickets<br> where TicketSTatusID &lt;&gt; 6</p> <p>because i want to send email with the records of ticket which Status is not closed(6)</p> <p>is it?? <br> </p> 2009-04-23T07:46:23-04:003112630http://forums.asp.net/p/1414354/3112630.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>you need to declare a cursor as what in the link porivded by mudas, which loop all the data for you select statement than send the email one by one</p> <p>refer to the link for the cursor function</p> 2009-04-23T07:57:04-04:003112645http://forums.asp.net/p/1414354/3112645.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>Declare a cursor for this query as i have done there</p> <p>&nbsp;</p> 2009-04-23T08:04:37-04:003112651http://forums.asp.net/p/1414354/3112651.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>&nbsp;omg..this is hard..i seriously cant do this sia..</p> <p>haiz.. :( <br> </p> 2009-04-23T08:06:57-04:003112666http://forums.asp.net/p/1414354/3112666.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>What are the columns in your query that you want to use in email?</p> 2009-04-23T08:15:48-04:003112676http://forums.asp.net/p/1414354/3112676.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>yes, can you provide what do you want the email looks like, do you store the email's id in the same table as what you hv write just now?</p> 2009-04-23T08:20:06-04:003112686http://forums.asp.net/p/1414354/3112686.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>&nbsp;i want to display all the columns in my tickets table where the status is not equals to closed..</p> <p>the columns are ticketsID,requesterID,SupportStaffID etc etc.... </p> <p>and u need the emailID column too? <br> </p> 2009-04-23T08:26:58-04:003112740http://forums.asp.net/p/1414354/3112740.aspx/1?Re+Sending+of+email+Re: Sending of email! <p>i not sure the datatype you have they so you may need to change it &amp; you may need to join other table to get the email address to sent to the recipient<br> just gv a try here you may need tweak here and there</p> <p>DECLARE <br> @out_desc VARCHAR(1000), <br> @out_mesg VARCHAR(10)</p> <p>DECLARE @ticketsID int, <br> @requesterID int, <br> SupportStaffID int,<br> emailID varchar(100)</p> <p>DECLARE C1 CURSOR READ_ONLY <br> FOR <br> Select * from ITHelpdesk.dbo.tickets<br> where TicketSTatusID &lt;&gt; 6<br> OPEN C1 <br> FETCH NEXT FROM C1 INTO <br> @ticketsID,@requesterID,@SupportStaffID, @emailID <br> WHILE @@FETCH_STATUS = 0 <br> BEGIN <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SET @body = '&lt;table&gt;&lt;tr&gt;&lt;td&gt;TicketID:&lt;/td&gt;&lt;td&gt;' &#43; @ticketsID &#43; '&lt;/td&gt;&lt;/tr&gt;' &#43;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&lt;tr&gt;&lt;td&gt;requesterID:&lt;/td&gt;&lt;td&gt;' &#43; @requesterID &#43; '&lt;/td&gt;&lt;/tr&gt;' &#43; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '&lt;tr&gt;&lt;td&gt;SupportStaffID:&lt;/td&gt;&lt;td&gt;' &#43; @SupportStaffID &#43; '&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;' <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXEC sp_send_mail <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @emailID, <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'xxxxxxx', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @email, <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'Birthday Wishes', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @body, <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'htmlbody', <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @output_mesg = @out_mesg output, <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @output_desc = @out_desc output<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINT @out_mesg <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PRINT @out_desc <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FETCH NEXT FROM C1 INTO <br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; @ticketsID,@requesterID,@SupportStaffID, @emailID <br> END <br> CLOSE C1 <br> DEALLOCATE C1 <br> </p> 2009-04-23T08:48:49-04:00