Index: addressbook/gui/contact-editor/e-contact-editor.c
===================================================================
--- addressbook/gui/contact-editor/e-contact-editor.c	(revision 35717)
+++ addressbook/gui/contact-editor/e-contact-editor.c	(working copy)
@@ -31,6 +31,8 @@
 #include <libgnomeui/gnome-window-icon.h>
 #include <libgnome/gnome-util.h>
 #include <glib/gi18n.h>
+#include <glib.h>
+
 #include <libgnome/gnome-help.h>
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
@@ -3075,17 +3077,78 @@
 
 }
 
+/* This function validates a phone entry */
+static gboolean
+is_valid_phone(EABEditor *editor)
+{
+	gint  i;
+	const gchar *valid_entry = "1234567890+#*" ;
+	gchar *validated_phone;
+	
+	for (i = 1; i <= PHONE_SLOTS; i++) {
+		gchar *phone;
+		gint   phone_type;
+	
+		extract_phone_record (E_CONTACT_EDITOR(editor), i, &phone, &phone_type);
+		validated_phone = g_strdup(phone);	
+		if (!STRING_IS_EMPTY (phone)) {
+			g_strcanon (validated_phone, valid_entry, '?');
+			if (!(g_str_equal (phone, validated_phone)))
+			{	
+				return TRUE;
+			} 
+		}	
+	}
+		return FALSE;
+}
 
+/* This function validates an email entry */
+static gboolean
+is_valid_email(EABEditor *editor)
+{	
+	gint i;
+	gchar* pos_of_at, *pos_of_dot;	
+	gssize len;
+	
+	for (i = 1; i <= EMAIL_SLOTS; i++) {
+		gchar *address;
+		gint   location;
+
+		extract_email_record (E_CONTACT_EDITOR(editor), i, &address, &location);
+		
+		if (!STRING_IS_EMPTY (address)) {
+			pos_of_at = g_strrstr (address, "@");
+			pos_of_dot = g_strrstr (address, ".");
+			if (pos_of_at) {
+				len = pos_of_at - address;
+				if (g_strrstr_len (address, len, "@"))
+					return TRUE;	
+				// Check if "." proceeds "@"
+				len = pos_of_at - pos_of_dot;
+				if (len > 0)
+					return TRUE;
+				// Check if "@" is the first character or "." is the last character
+				if (g_str_has_prefix (address,"@") || g_str_has_suffix(address,"."))
+					return TRUE;
+			}
+			else	
+				return TRUE;
+		}
+	}
+	return FALSE;
+}
+
 /* insert checks here (date format, for instance, etc.) */
 static gboolean
 e_contact_editor_is_valid (EABEditor *editor)
 {
 	EContactEditor *ce = E_CONTACT_EDITOR (editor);
 	GtkWidget *widget;
+	GtkWidget *msg_dialog;
 	gboolean validation_error = FALSE;
 	EIterator *iter;
 	GString *errmsg = g_string_new (_("The contact data is invalid:\n\n"));
-
+	
 	widget = glade_xml_get_widget (ce->gui, "dateedit-birthday");
 	if (!(e_date_edit_date_is_valid (E_DATE_EDIT (widget)))) {
 		g_string_append_printf (errmsg, _("'%s' has an invalid format"),
@@ -3100,7 +3163,30 @@
 					e_contact_pretty_name (E_CONTACT_ANNIVERSARY));
 		validation_error = TRUE;
 	}
-
+	
+	if(is_valid_email(editor))
+	{	msg_dialog = gtk_message_dialog_new(NULL,
+						    GTK_DIALOG_MODAL, 
+						    GTK_MESSAGE_WARNING,
+						    GTK_BUTTONS_OK,
+						    "%s", _("Invalid email"));
+		gtk_dialog_run (GTK_DIALOG(msg_dialog));
+		gtk_widget_destroy (msg_dialog); 
+		return FALSE;
+	}
+	
+	if (is_valid_phone(editor))
+	{	
+		msg_dialog = gtk_message_dialog_new(NULL,
+						    GTK_DIALOG_MODAL,
+						    GTK_MESSAGE_WARNING,
+						    GTK_BUTTONS_OK,
+						    "%s", _("Invalid phone number"));
+		gtk_dialog_run (GTK_DIALOG(msg_dialog));
+		gtk_widget_destroy (msg_dialog); 
+		return FALSE;
+	}
+	
 	iter = e_list_get_iterator (ce->required_fields);
 	for (e_iterator_last (iter);
 	     e_iterator_is_valid (iter);
Index: addressbook/ChangeLog
===================================================================
--- addressbook/ChangeLog	(revision 35717)
+++ addressbook/ChangeLog	(working copy)
@@ -1,3 +1,10 @@
+2008-07- 03  Roshan Kumar Singh  <roshan.singh08@yahoo.com>
+	
+	** Fix for bug #513438
+
+	* e-contact-editor.c:
+	Added checks for validating email and phone number.
+
 2008-07-03  Milan Crha  <mcrha@redhat.com>
 
 	** Fix for bug #540152
