Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Wednesday, December 17, 2014 6:20 AM
Sending Invitations to my friends using Emails Scheduling
>Create a Sql Server Jobs and Schedulizing
Wednesday, December 17, 2014 7:39 AM ✅Answered
I want to send my Birthday Party Invitation to all my friends.invitation date is 20-12-1988
Subject:BirthDay_Invitation
body: Hai Friends, Come to Birthday Party
Receipients:
teppala.chinna@gmail.com
teppalaumamahesh@gmail.com
Then you can schedule this e-mail in MS Outlook itself ;)
Anyway,
1. You can create stored procedure to send e-mail - usp_sendTextMail
2. Create main SP - usp_SendInvitation
-- Declare @From, @To, @Body, @Subject variable and set the values
-- Pass above variables to usp_sendTextMail(@From,@To...)
3. Schedule EXEC usp_SendInvitation <<Params>> and set the timing in Job step.
Note: In you have to change body, subject etc in future; you can customize it in usp_SendInvitation SP.
-Vaibhav Chaudhari
Wednesday, December 17, 2014 9:22 AM ✅Answered
First off configure database mail (Which you can do from SQL Server agent).
Then use this t-sql query to send the email (which you can schedule in the agent job). The name of the Email profile you created for the database mail has to be filled in at the variable @profile_name:
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'SQL Mail Profile',
@recipients = 'teppala.chinna@gmail.com; <teppalaumamahesh4829@hotmail.com'>,
@subject = 'Birth Day Invitations i.e 20-12-1988',
@body= 'Attend the Birthday party'
--@query = @query_mail,
<--@query_result_separator> = '',
<--@query_result_no_padding> = 0,
<--@query_result_header> = 0
END
If you haven't configured database mail yet, go to Management -> Database mail in SQL Server managemt studio and press configure database mail and follow the wizard. The profile name you chose here has to be filled in on the above query.
Wednesday, December 17, 2014 6:42 AM
Email Subject, body, receipients - information is always same?
-Vaibhav Chaudhari
Wednesday, December 17, 2014 6:50 AM
I want to send my Birthday Party Invitation to all my friends.invitation date is 20-12-1988
Subject:BirthDay_Invitation
body: Hai Friends, Come to Birthday Party
Receipients:
teppala.chinna@gmail.com
teppalaumamahesh@gmail.com
Wednesday, December 17, 2014 7:12 AM
Do you have receipient list stored somewhere? Or is it always static? If static use a t-sql script calling sp_send_dbmail to send the email
http://sqljourney.wordpress.com/2013/05/25/sql-server-send-mail-using-sp_send_dbmail/
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page
Wednesday, December 17, 2014 7:35 AM
Examples:
My Email Id: (sender Mail Id) teppalaumamahesh@gmail.com
Subject : Birth Day Invitations
i.e 20-12-1988
Body : Attend the Birthday party
Receipients :
teppala.chinna@gmail.com
teppalaumamahesh4829@hotmail.com
**Writing a Sql Query for that scenario **
Using Sql Server agent Job Scheduling i want to send my Invitations
Wednesday, December 17, 2014 7:59 AM
Hi,
Why you ever want to send this invitation through SQL Agent, you better use other email service for this purpose,
I would recommend you to use Outlook/gmail/hotmail etc for this purpose.
SQL Agent Jobs primarily used for database related automated tasks.
Please mark solved if I've answered your question, vote for it as helpful to help other users find a solution quicker
Praveen Dsa | MCITP - Database Administrator 2008 | My Blog | My Page
Wednesday, December 17, 2014 8:29 AM
You need to read the MSDN topic
http://technet.microsoft.com/en-us/library/ms188235(v=sql.105).aspx
Wednesday, December 17, 2014 8:34 AM
Hello ,
Please follow the steps to know the concept
"Steps to Setting Up SQL Agent"
http://sqlmag.com/database-administration/sql-views-steps-setting-sql-agent
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/
Wednesday, December 17, 2014 8:37 AM
Hello ,
Please follow the steps to know the implementation
"Steps to how to setup SQL Server email "
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/