Individual Email

Hi ALL ,
I have a customer table with columns Name, Email & Date
Data example
Ron  [email protected]  6/19/2014
John [email protected] 6/19/2014
Darren [email protected] 6/19/2014
Now  i need to send emails to all of them where the date  column = getdate()
Kindly help me with the code to send email individually . 
So for example here all 3 records should be sent using their respective email address .
Like first email just to Ron none other from the list then John then Darren .
Please help. Let me know if some other info is required .
Thanks
Priya

Try the below code
DECLARE
@RowId AS INT,
@LoopStatus AS INT,
@firstname VARCHAR(MAX),
@lastname VARCHAR(MAX),
@Email VARCHAR(MAX),
@Priority varchar(100),
@date date,
@tableHTML NVARCHAR(MAX) ;
--Sample table and data
create table tablename
firstname varchar(100),
lastname varchar(100),
email varchar(100),
Priority char(10),
currentdate datetime
Insert into tablename values('Ron','Zengrake','[email protected]','High',GETDATE()),
('Jon','Zengrake','[email protected]','low',GETDATE()),
('Jon','Zengrake','[email protected]','low',GETDATE())
create table #temp
id int identity(1,1),
firstname varchar(100),
lastname varchar(100),
email varchar(100),
Priority char(10),
currentdate datetime)
insert into #temp(firstname,lastname,email,Priority)
SELECT firstname,lastname,email,Priority FROM dbo.tablename where cast(currentdate as DATE)=CONVERT(date,GETDATE(),112)
set @LoopStatus=1
set @RowId=1
WHILE @LoopStatus>0
BEGIN
select
@firstname=firstname,
@lastname=lastname,
@Email=email,
@Priority=Priority,
@date=currentdate
from
#temp
where id=@RowId
if @@ROWCOUNT = 0
begin
set @LoopStatus=0
end
else
begin
SET @tableHTML =
N'<H1>Report</H1>' +
N'<table border="1">' +
N'<tr><th>first Name</th><th>last name</th> <th>email</th> <th>Priority</th>
</tr>' +
CAST ( (
Select
td=db.firstname,' ',
td=db.lastname,' ',
td=db.email,' ',
td=db.Priority,' '
FROM tablename db where db.email=@email
FOR XML PATH('tr'), TYPE
) AS NVARCHAR(MAX) ) +
N'</table>' ;
EXEC msdb.dbo.sp_send_dbmail @recipients=@Email,
@subject = 'Report',
@body = @tableHTML,
@body_format = 'HTML' ;
end
set @RowId=@RowId+1
end
drop table #temp
--Prashanth

Similar Messages

  • How can i create a hyperlink to individual emails?

    I would like to be able to create a hyperlink to click through to individualk emails.  I plan on creating a simple database in Excel and would like to be able to instantly access individual emails.  I have done this in the past with files stored on my harddrive.  It's a really useful way of managing thousands of emails.
    Thanks!
    Nick

    thanks 'a brody' - i have found MailTags as a 3rd part app which may do the trick.  in the past i have resorted to saving pdf print outs of mails to a hard drive and then using a hyperlink to the file.  it just doesn't seem very elegant (this solution can be useful where i then share the database with colleagues using the same networked drive).
    i can't imagine i'm the only person trying to categorise and track leads - perhaps i need to bite the bullet and source a really good CRM app?

  • How do I backup or copy an email account or individual emails from a closed email account

    How do I backup or copy an email account or individual emails from a former employer on my iPhone 5s.  I can open the emails, but don't have access to the server - just messages on iPhone.  Thanks!

    Hello stoutstout,
    I imagine that forwarding the email does not function (since your account is closed), so I do not know what other options there would be.
    I know this is inconvenient (and unprofessional if you need those emails forwarded) but I would probably just screen shot all the important information I need from these emails.

  • Individual emails are deleted without my interference, and no longer be found

    Individual emails are deleted without my interference, and no longer be found. In one case I could restore the email with time-machine, in the other case there is no time machine backup for that time stamp.
    How can this happen ? Is there a hadware problem or a virus ?
    manny thanks
    Ole

    You don't need to get your domain name registrar to do this - you should easily be able to do it yourself.
    Firstly, ensure that your domain name is entered into the Personal Domain name setting of your MobileMe account.
    Go to your domain name registrar and then set up CNAME forwarding if they provide this and forward your domain name to web.me.com - this is all you need do - you don't need to fiddle with nameservers or anything else like that.
    If they don't provide CNAME forwarding then you can use web forwarding instead.

  • Mail does not create new emails based on the highlighted mailbox, but rather the receiving mailbox of whatever individual email happens to be highlighted. This was not the case prior to Lion. Is this a bug or an error on my part?

    Mail does not create new emails based on the highlighted mailbox, but rather according the receiving mailbox of whatever individual email happens to be highlighted. This was not the case prior to Lion. Is this a bug or an error on my part? (I do have the setting for creating new emails from the highlighted mailbox checked.)

    The questions about time was not only because of thinking about the Time Machine, but also possible impact on recognizing which messages remaining on a POP server (doesn't apply to IMAP) have been already downloaded. In the Mail folder, at its root level, in Mail 3.x there is a file named MessageUidsAlreadyDownloaded3 that should prevent duplicate downloading -- some servers may not communicate the best with respect to that, and the universal index must certainly be involved in updating that index file. If it corrupts, it can inhibit proper downloading. However, setting the account up in a New User Account and having the same problem does not point that way, unless your POP3 server is very different from most.
    That universal index is also typically involved when messages are meant to be moved from the Inbox to another mailbox -- in Mail 3.x the message does not move, but rather is copied, and then erased from the origin mailbox. That requires updating the Envelope Index to keep track of where the message is, and should keep track of where it is supposed to have been removed after the "Move".
    Ernie

  • Would like to change individual email icons

    I'm looking to change my individual email icons - I have two Gmail accounts set up on my blackberry.  One is for school using the gmail platform, so both icons are the same with the little globe on the bottom of the message icon. 
    I would like to replace the image of the message icon with the school's logo for the second email account.  Is there a way to do this? 
    I have a verizon account for my tour. 
    Thanks in advance for your help!

    No, it is not possible... but may I suggest that you place the two icons on different sides of the screen, like one on the left and one on the right, or even different rows, so that you know "right is school, left is personal", or something.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • URGENT trouble pdf attached to individual emails from word

    Hello, I have Acrobat XI pro and created a word file with fields that are imported automatically from an excel sheet. This works perfect. Then i like to have pdf maker generate individual emails with individual pdf attachement. This works too and I can see all my messages in Outlook send box. My problems is after I send the emails :
    - beneficiaries receive and attachement "winmail.dat" which they cannot open. If they have Outlook, they can see the file as pdf and can open it.
    - the emails don't show in the "sent" box of my Outlook or my server.
    I am using Outlook 2010 32bits and Word 2010. Windows.
    Thank you for your help !!!

    Maybe this is relevant: http://support.microsoft.com/kb/958012

  • Having problems with Facebook on my ipad2. Updated operating system. Problem started before that and continues. Can't click on like or make comments. Sent email to Facebook. Their response was that they don't answer individual emails but read them. Sigh!

    Stated above, I have issues with Facebook and my iPad 2. I have updated the operating system, but the problem started before that. Can't click on like or enter comments. Problem started about a week ago. Sent email to Facebook and they responded that they don't answer individual emails but read them. Lots help that was.

    Facebook is basically broken, at least as far as it pertains to mobile browsers. THey changed something in their coding and now mobile browsers don't work with facebook. ANd their app, well their app has been less than stellar for a long time.
    Unfortunately, it's up to facebook to fix things, not apple. All you can do is find work arounds. Look for third party apps, I have one called Facely HD which seems to work reasonably well (even though it does seem to not see all posts). There may be others that work better. You can also simply not access facebook on your mobile until they fix it.
    It's all on them and users can only be patient or find other ways to work around it.

  • I lost all the icons at the bottom of individual emails on my iPhone. How do I get them back???

    I lost all the icons at the bottom of individual emails on my iPhone. How do I get them back???

    Open the mail app then press and hold the sleep/wake button until the red slide to power off thing appears. Without sliding the bar, press and hold the home button until the app quits.
    Also clear the mail app from multitasking bar too. Then open mail app and check again

  • Stop individual emails

    how do I stop individual emails from this forum

    Click or tap on Your Stuff at the top of this window. Select notifications and make a global change there. For individual threads click on the Stop Notifications link in the right column.

  • Individual emails go blank in Mac OS X

    hi
    My configuration,
    Mac OS X 10.7.5, 4 GB RAM
    Mail 5.3
    I don't have too many emails in my Inbox
    When I click on an individual email in Inbox I can see the header part (From, Subject, Date) but the body is blank
    I need to close Mail and reopen it, then it usually works
    What could be going wrong on my machine?
    Any help is appreciated
    Mahesh

    Because you said this ...  
    "When I click on an individual email in Inbox I can see the header part (From, Subject, Date) but the body is blank"
    If the body is blank then it can be a connection issue but since you see all green, then that's not the case.
    The connection doctor is just a troubleshooting feature.

  • How do i create a contact list in adobe send from my email contact list and how do avoid typing individual email adresses

    how do i create a contact list in adobe send from my email contact list and how do avoid typing individual email adresses

    Hi [email protected],
    The e-mail addresses will not be memorized in Adobe send but will be saved in sent items.
    You can use Adobe send outlook plugin to access your email contact list and send.
    You can download it here:Send Large Files Online - Share, Control, Track & Manage | Adobe Send
    Regards,
    Florence

  • Individual emails open in full screen, how do I resize them to open smaller automatically

    when I open individual emails they open in full screen. A friend said resize the email to what I want and hold down the CTRL button and close everything out. It worked but not permanently. How do I resize so my emails open to a smaller size on not take up the whole screen automatically.

    Have you tried setting Thunderbird to open messages in a tab rather than a window? Or better (IMHO) to not "open" them but to read them in the message pane below the message list.

  • I cannot open individual email entries in my webmail

    When I open my email account I cannot open any individual emails. If I use a Chrome browser, I am able to open my emails.
    There is a preview option in the account and I can see my emails in that preview window.

    I get plans and specification sent as attachments and they are pdf files.  When I go to open the attachment three options come up  1  Open with protected mode disabled
    2  Always open with protected mode disaled
    3  Do not opern with protected mode disabled.
    My only option is to open with protected mode disabled.
    But when I go online, I do not get that option - It just says problems with adobe and connot download.

  • Individual eMail Size

    Is there a way in which I can see the individual eMail size in BlackBerry (I have 8310 Curve) , like we have the size field in Outlook.

    There is no option to view individual mail sizes. But by default all the mails are reduced to 32KB and you can request more and you go on reading.
    tanzim                                                                                  
    If your query is resolved then please click on “Accept as Solution”
    Click on the LIKE on the bottom right if the post deserves credit

  • I have had difficulty with yahoo mail since the security update on Dec 23rd - have you? if so do you have a resolution? I can get into yahoo but then cannot open individual emails or folders!!!

    I have had difficulty with yahoo mail since the security update on Dec 23rd - have you? if so do you have a resolution? I can get into yahoo but then cannot open individual emails or folders!!!!

    this is total bullshit. so frustrated with this nonsense.

Maybe you are looking for

  • Use 2 Data Acquisiton Cards at the same time

    We are using PXI chasis for developing a test system. We want to use one card (PCI 6713) for analog output to the unit under test (UUT)and want to use the Dig I/O card to capture the response of the Device under test. currently i have two separate VI

  • List of WBS elements with Deletion Flags

    Hi Gurus, Please tell me, is there any report which gives me WBS elements which are deleted??? Please revert asap. Thank You

  • Javac AST Symbol Resolving for JavacTask.parse()

    Hello! I am currently working on a source code processor, based on an AST. I use the original javac library. I know that the javac package is not provided as API, but it suffices for a first prototype. I parse a file (multiple files) with JavacTask.p

  • Can I migrate photoshop elements 9 stuff to cs5 photoshop?

    sorry for the n00b question. I was looking at buying a macbook pro with cs5, but didn't want to lose my previous work editing and effects. to be more specific I'm doing website design in Columbia SC and wanted to know if they had image optimization f

  • Comments/Mark Up Not Showing

    I was e-mailed a PDF with the Comments/Mark Up function enabled so I could edit it, but when I downloaded and opened it the Tools drop-down menu was not showing it as enabled. I know others have been sent the same file enabled in the same way and hav