Thursday, October 31, 2019

Resend an email sent from SQL Server

Dear All,

Sometimes the email goes missing in the SQL server.

Find the email you want to resend using one of the following views in MSDB:

sysmail_allitems

sysmail_faileditems

Use following Query:


DECLARE @mailitemID INT = -- MailItem_Id here e.g 98765

DECLARE @profilename NVARCHAR(125);
DECLARE @recipients VARCHAR(2000);
DECLARE @copy_recipients VARCHAR(2000);
DECLARE @blind_copy_recipients VARCHAR(2000);
DECLARE @subject NVARCHAR(510);
DECLARE @body VARCHAR(2000);
DECLARE @body_format VARCHAR(20);
DECLARE @importance VARCHAR(6);
DECLARE @sensitivity VARCHAR(12);
DECLARE @query BIT;
DECLARE @attachment BIT;

--Get the information for the email
SELECT
@profilename = [profiles].[name],
@recipients = [mail].[recipients],
@copy_recipients = [mail].[copy_recipients],
@blind_copy_recipients = [mail].[blind_copy_recipients],
@subject = [mail].[subject],
@body = [mail].[body],
@body_format = [mail].[body_format],
@importance = [mail].[importance] ,
@sensitivity = [mail].[sensitivity],
@query = CASE WHEN [mail].[query] IS NULL THEN 0 ELSE 1 END,
@attachment = CASE WHEN [mail].[file_attachments] IS NULL THEN 0 ELSE 1 END
FROM msdb.dbo.sysmail_allitems mail
INNER JOIN msdb.dbo.sysmail_profile profiles ON mail.profile_id = profiles.profile_id
WHERE mailitem_id = @mailitemID;

IF @query = 0 AND @attachment = 0
BEGIN

--Re send the email
EXEC msdb.dbo.sp_send_dbmail
@profile_name = @profilename,
@recipients = @recipients,
@copy_recipients = @copy_recipients,
@blind_copy_recipients = @blind_copy_recipients,
@subject = @subject,
@body = @body,
@body_format = @body_format,
@importance = @importance,
@sensitivity = @sensitivity

END
ELSE
BEGIN
RAISERROR('unfortunately this script cannot send',11,0,@mailitemID)
END

I've verified its working fine.


Friday, June 21, 2019

mysql update query



Mysql update query for



SELECT * FROM wordpress99.wp_users;

update wordpress99.wp_users set user_pass=MD5('!@#$%^@2019') where ID=1

Friday, April 12, 2019

DHL web service - timeout

Hello team,

Las few days faced issue with DHL side, following error message received,

DHShipment() The request channel timed out while waiting for a reply after 00:00:59.9990010. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.

windows activation

Windows activation Steps, 1} Search command prompt 2} right click and run as an administrator in command prompt 3}  slmgr.vbs -ipk XXXXX-XXXXX-XXXXX-XXXXX-XXXXX (Enter the product key) 4} Enter & 30 Sec wait

Note:- Any get Error Restart the PC & check

2019-04-09.png