Saturday, February 27, 2010

Google Buzz Posting from Asp.net Web Application

Earlier I have discuss about how to post tweet from asp.net web application. In this article I would discuss how to post google buzz from asp.net web application.

What is Google Buzz
Google Buzz is Twitter like service from google, inside gmail.

Following Procedure explains how to send google buzz from asp.net website without using google buzz api.

Step 1: As Google Buzz require a valid gmail account. You need to decide, from which gmail account you would like to post google buzz. For this example, i would be posting google buzz from my gmail account. i.e. dotnetguts [at the rate] gmail [dot] com.

Step 2: Enable Google Buzz posting by sending email. Please follow following to do so.
a) Log into your gmail account.

b) Open Google Buzz.

c) Click on Connected Sites link as shown in figure.


d) Click on Add button associated with "Post via buzz@gmail"


e) Click on save button.


Step 3: Open Visual Studio and create new asp.net website.

Step 4: Arrange web control as shown in following figure.



Step 5: Call following Function from Button Click Event.


private void PostBuzzMsg(string strEmail, string strPassword, string BuzzMsg)
{
//Create Mail Message Object with content that you want to send with mail.
System.Net.Mail.MailMessage MyMailMessage =
new System.Net.Mail.MailMessage(strEmail, "buzz@gmail.com",
BuzzMsg + "... http://dotnetguts.blogspot.com", string.Empty);

MyMailMessage.IsBodyHtml = false;

//Proper Authentication Details need to be passed when sending email from gmail
System.Net.NetworkCredential mailAuthentication = new
System.Net.NetworkCredential(strEmail, strPassword);

//Smtp Mail server of Gmail is "smpt.gmail.com" and it uses port no. 587
//For different server like yahoo this details changes and you can
//get it from respective server.
System.Net.Mail.SmtpClient mailClient =
new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);

//Enable SSL
mailClient.EnableSsl = true;

mailClient.UseDefaultCredentials = false;

mailClient.Credentials = mailAuthentication;

mailClient.Send(MyMailMessage);
}

Step 6: Run asp.net website and Send Message.



Now Check your Buzz to see how message appears.

1 comment:

Umair Tahir said...

Google Buzz posting from the Asp.net application I tried this example in web Application the strange thing is it does not required Google Api. Last time i tried yahoo contact importer from dot.net and google contact importer it required a google api. Thanks for the nice article

Regards

-.J
Custom Web design

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape