Skip to main content

Posts

Showing posts from October, 2013

.Net: Sending email with AlternateView, LinkedResources: System.Net.Mail

Recently we faced an issue in receiving mails from same (sender) domain email account but using different SMTP server. Mail body has few resources like GIF, JPEG and they are loaded with AlternateView (System.Net.Mail.MailAddress.AlternateViews) parameter with linked resources. 
Ex: sender@example.com sends mail to recevier@example.com using a different SMTP server (ex: mailserver.com) i.e. not using example.com (SMTP) domain. Result of this scenario: Receiver did not receive any email. 
In mail body, resources can be loaded with the below options. Absolute path (http://www.nehemiahj.com/image.jpg)Relative path (/image.jpg)Resources (System.Resources.ResourceManager)
The mail could be blocked due to Exchange Intelligent Message Filter as in Microsoft Exchange server. Also to note that emails to other providers like GMAIL, YAHOO were successful.
When we remove all the resources in the email body, email reached the destination mail boxes but without any resources. Initially, to get the resour…

Smart Tools-1: Add Version and Copy Content

Recently I published a Sitecore tool (idea was old but did not get time to work on itJ) to add a version and copy the field content from the source language to the selected destination language(s).
This tool does the following tasks.  It adds a new version to the selected destination language(s) version.It copies the content from the source language (context item) to all selected destination language(s).It has the option of including the child items as well.
Installation:
There is a package which you can download from the Sitecore marketplace. You can use Sitecore inbuilt installation wizard to install the package. The package includes an assembly, XML control and a config file.
How to use: Once installed, you will have a menu item in the content tree.

On selecting this menu, a window will open with all the available options. Source language is from the context language. If the source language is different from the default language, please change it and select the menu. 

An alert window will…

Tools: Recycle .NET Application Pool Remotely

Recently I created an application to recycle the .net Application pool without logging into the server. It is a .net website with a dropdown showing the list of servers. On selecting a server, user can populate the all the application pools available in that server and user can recycle the application pool.

Page with dropdown and buttons.

List of application pools and a button to recycle it. 


The server list can be added in the configuration file.Status Check will provide you the status of the application pool.This .Net application should run with an account which has admin access to all the servers.SMTP can be configured in the web.config.After each recycle, this application will send a mail to the list of configured email ids.This application logs the activity in the logs folder.

You can download the application here.

Sitecore: Image Resizer Pipeline (ResizeProcessor) Pipeline

Sitecore has a feature in processing high resolution images while rendering in the website.

Let’s say, content authors wants to use an image as Icon, Thumbnail and full scale in the website. Normally, they will upload three images in icon sized, thumbnail sized and full scale images. They will have different name to differentiate the sizes. They can use (<imgsrc="/url/image.png"height="100"width="100") image tag with height and width but it will render with high resolution image size even for thumbnail. But Sitecore has an option of resizing the image at runtime. 
There is a pipeline in the <getMediaStream>.
<processortype="Sitecore.Resources.Media.ResizeProcessor, Sitecore.Kernel" />
This pipeline has the following advantages. Depending upon the width and the height in the media url, this will resize the image and render it.  /~/media/image.JPG?h=300&w=400While resizing the image, it will reduce the size of the image as well.Aut…

Sitecore: Ideal way to execute a long running job

One of our requirement was to execute a long running job in Sitecore Content Tree. In many cases, we end up in Timed out error. Obviously we can increase request timed out configuration. But Sitecore has a very good way of executing such long running task in a ProgressBox.

ProgressBox.Execute(JobName, JobTitle, ProgressBoxMethod, Params);
//Sitecore.Shell.Applications.Dialogs.ProgressBoxes ProgressBox.Execute("Job Name", "Job Title ", newProgressBoxMethod(ExecuteOperation), item);
This line of code will start progress box and the functionality will be executed in the ProgressBoxMethod.
protectedvoid ExecuteOperation(paramsobject[] parameters)         { //Do the operations //Logging for the job             Sitecore.Context.Job.Status.Messages.Add("Logs for the job: JobName"); //Is the job done? if (Sitecore.Context.Job.IsDone)             { //On completing the job             }                    }
By using the progress box, the long running tasks are executed succes…