.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Email Validation on mail server

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :ASP.Net


I want to perform Email validation on mail server through my asp.net application. I am able to check domain but whole email address checkinh is still awaited.

Thank You

View Complete Post

More Related Resource Links

Send Email from SQL Server Express Using a CLR Stored Procedure

One of the nice things about SQL Server is the ability to send email using T-SQL. The downside is that this functionality does not exist in SQL Server Express. In this tip I will show you how to build a basic CLR stored procedure to send email messages from SQL Server Express, although this same technique could be used for any version of SQL Server.

If you have not yet built a CLR stored procedure, please refer to this tip for what needs to be done for the initial setup.

Server side validation of Fileupload control not working



I've tried this method in my code behind to try and validate that the Fileupload control has a file or not. I get the error message the the event "Server Validate" cannot be found. Can anyone tell why? Thanks.

Public Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args As System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate

' Get file name

        Dim uploadAvatar As FileUpload = DirectCast(AdvertisementForm.FindControl("uploadAvatar"), FileUpload)

        Dim UploadFileName As String = uploadAvatar.PostedFile.FileName

        If UploadFileName = "" Then
            ' There is no file selected
            args.IsValid = False
            Dim Extension As String = UploadFileName.Substring(UploadFileName.L

Email Help (System.Net.Mail)


Hi I have a annoying problem. 
I have created a page which takes users details for a quote.

I have then created the form to be emailed to both the user and myself. (Which works fine ATM)

However I would also like to be able to attach a file containing terms and conditions to the email.

I have tried doing this using 

EmailMsg.Attachments.Add(new Attachment("C:\\attachme.txt"));

But everytime that line of code is hit it fails and is caught by my try catch.

Take that line out and the email sends fine, put it in and it breaks the whole page.

Am I missing something really obvious?

I cannot send mail using gmail smtp server


 Here is my code

Dim message As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
        message.To.Add("from textbox field")
        message.Subject = "Testing"
        message.From = New System.Net.Mail.MailAddress("sender email ")
        message.Body = "Just Testing"

        Dim smtp As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()

        Dim client As SmtpClient = New SmtpClient()
        smtp.Credentials = New System.Net.NetworkCredential("username", "password")
        smtp.Port = 25
        smtp.Host = "smtp.gmail.com"
        smtp.EnableSsl = True
        smtp.DeliveryMethod = SmtpDeliveryMethod.Network
        lblmsg.Text = "Your Email has send"


send email using Godaddy server by gmail


 Hello ,


My site is hosted  in Godaddy server. And i am using google apps for emailing a/c for that i have changed the  MX-records and then it is working fine.

Then i finished my web site


it is working fine there .

in the site there is a  contactus link which opens


this page basically should send a mail to a particular email id .

for sending mail I am using gmail a/c . (Here is the full code)


public void SendEmail(string From,string GmailEmail, string GmailPassword, string To, string Subject, string Body,      
        FileUpload fileupload)

        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
        mail.From = new MailAddress(From, "One Ghost", System.Text.Encoding.UTF8);
        mail.Subject = Subject;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;

How to use server side validation to ensure image field is not null


I'm having trouble accomplishing the above. Below is all the mark up and code. I'm not getting error messages, but the validate image function is not working (fileupload portion is working ok).

In my attempt below---not sure if it's the simplest or best validation approach anyway---the "UserId" parameter appears during rendering to be empty---but in most methods I have it successfully containing or referring to the logged-in user's identification.

Following is the control that refers to the image field (page = advertisement.aspx):

<asp:Image ID="Image" runat="server" ImageUrl ='<%#Eval("UserId","Image.aspx?UserId={0}") %>'


Following is the successful code behind for the page image.aspx referred to above (page = image.aspx.vb):

Partial Public Class Image

    Inherits System.Web.UI.Page

    Public Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Request.QueryString("UserId") IsNot Nothing Then

            ' Get the connection string from Web.config.

            Using conn As New Sq

Sending Email by exeucting a stored proc on SQL Server that references CLR

Hi Guys, I want to modify the data type of the @body variable in the stored procedure that sends an email. The stored procedure is as follows:   CREATE PROCEDURE [dbo].[spSendMail4]<br/> @recipients [nvarchar](4000),<br/> @cc [nvarchar](4000),<br/> @subject [nvarchar](4000),<br/> @from [nvarchar](4000), @body [nvarchar](4000), @attachment [nvarchar](4000)<br/> WITH EXECUTE AS CALLER<br/> AS <br/> EXTERNAL NAME [SMTPCLR].[StoredProcedure].[spSendMail]<br/> GO   I want to change the @body variable to data type: text. The reason for this, is because I am sending an HTML email whose content (characters) exceed 8000. Basically the new stored procedure should looks like below:   CREATE PROCEDURE [dbo].[spSendMail4] @recipients [nvarchar](4000), @cc [nvarchar](4000), @subject [nvarchar](4000), @from [nvarchar](4000), @body text, @attachment [nvarchar](4000) WITH EXECUTE AS CALLER AS EXTERNAL NAME [SMTPCLR].[StoredProcedure].[spSendMail] GO   If attempt to make this change, I get the below error:   CREATE PROCEDURE for "spSendMail" failed because T-SQL and CLR types for parameter "@body" do not match.   Understandably so, because from the article http://msdn.microsoft.com/en-us/library/ms131092%28SQL.100%29.aspx CLR data type (.NET Framework) is not compa

Server-side validation on an Entity Framework required field (property) does not work!

Has anyone had issues getting server-side validation on an Entity Framework required field (property) to work? The data type is a string (nvarchar). Server-side validation for required fields of other data types WORK fine. Only string fields have issues. I get the following error on UpdateModel(obj); of my POST method within the controller. Exception Details: System.Data.ConstraintException: This property cannot be set to a  null value.Source Error: Line 4500:                OnTextChanging(value);Line 4501:                ReportPropertyChanging("Text");Line 4502:                _Text = StructuralObject.SetValidValue(value, false);Line 4503:                ReportPropertyChanged("Text");Line 4504:                OnTextChanged(); I've even tried data annotations like this but it seems to get ignored.     [MetadataType(typeof(ObjMD))]     public partial class Obj     {    

C# , Sending email through exchange server?

I've searched on this and tried several methods using System.Net.Mail but I can't get it to work. I want to send email using the Exchange server they have at work. Anyone could show me how to do this (server requires authentication)   Thanks in advance

SQL Server + ASP.NET Security Validation + HTML Markup Security

Hey everyone!I have an application, that for example, the customer gives me their Address. I store it in my database using the below code:        Dim connectionString As String = ConfigurationManager.ConnectionStrings("DMBConnstring").ConnectionString         Dim insertSql As String = "INSERT INTO BasicUserProfile(UserGuid, Firstname, Lastname, Nickname, Address1, City, State, Zip, DOB, Gender, SeekingGender, Sexuality, SeekingSexuality, HaveKids, WantKids, BodyType, SeekingBodyType, Ethnicity, SeekingEthnicity, Religion, SeekingReligion, Smoking, SeekingSmoking, Education, SeekingEducation, Relationship, SeekingRelationship) " _         & "VALUES (@UserGuid, @Firstname, @Lastname, @Nickname, @Address1, @City, @State, @Zip, @DOB, @Gender, @SeekingGender, @Sexuality, @SeekingSexuality, @HaveKids, @WantKids, @BodyType, @SeekingBodyType, @Ethnicity, @SeekingEthnicity, @Religion, @SeekingReligion, @Smoking, @SeekingSmoking, @Education, @SeekingEducation, @Relationship, @SeekingRelationship)"         Dim connectionString As String = ConfigurationManager.ConnectionStrings("myconnstring").ConnectionString        Dim insertSql As String = "INSERT INTO BasicUserProfile(UserGuid, Firstname, Lastname, Nickname, A

SQL Server Tables and Exchange Web Services sample does not include email body

I've sucessfuly implemented the above, very useful example. However, I cannot work out how to include the Body of the email with the reast of the data. Can anyone shed some light for me? Thanks Robert

Trying to email through SMTP on server 2008

I have the following form and trying to click a button and email through an SMTP server. Any suggestions? Thanks.<table class="style1" bgcolor="#003366" cellpadding="3" cellspacing="3"> <tr> <td class="style2"> Your name:<br /> <asp:TextBox ID="txtHDName" runat="server" Width="161px"></asp:TextBox> <br /></td> </tr> <tr> <td class="style2"> Your email:<br /> <asp:TextBox ID="txtEmail" runat="server" Width="161px"></asp:TextBox></td> </tr> <tr> <td class="style2"> PC name:<br /> <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> </td> </tr> <tr> <td class="style2"> Problem:<br /> <asp:DropDownList ID="DropDownList2" runat="server" Width="128px"> </asp:DropDownList> &l

Regular Expression, Email Validation, Consective dots name part

Hi All Can you please help me to modify this regex to validate consecutive dots in the name part (before @) of the email string.  For example, i want to disqualify an email string like (george...antony@gmail.com).  But an email string with single dots in the name part should be allowed (george.antony@gmail.com).   This regex is validating the consecutive dots after the @ sign (domain part) .    All other validation with this regex is as expected.   ^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$     Thanks in advance george

SSIS 2005 - Send Mail Task - signature appended to email is garbled - unicode problem?

Hi, I'm pretty new to SSIS so go easy on me. I have a Send Mail Task to notify if a file cannot be imported - the mailbody is created on the previous step by a VB.NET script task to include the name of the file and the path it's been archived to. The problem I'm having is that while the body of the email I've created is displaying fine, our company's Exchange server appends a signature to all emails, and this is coming up as undisplayable characters, presumably due to some kind of unicode encoding problem. I've tried casting the email body in an expression to DT_STR (doesn't work as DT_STR "cannot be converted to a supported type" which seems a bit odd but never mind), DT_WSTR (garbled signature), DT_TEXT/DT_NTEXT (strange error on this one - "Attempted to read or write protected memory") none of those ideas worked, and I'm a bit stumped now. Can anyone help? I'm using SSIS 2005 with SP3

Sending an email with a link that verifies an id in sql server

I have an online job application program that the user fills out and submits the information to our database and on the last page they give there email address so that we can send them an email that has a link that is associated with the ID that's autogenerated by the sql server database when the user submits the information, when the link is clicked it verifies to the database to keep the information submitted by that user per their autogenerated ID. Below is the code that i've written to send the email I have the link setup to go to yahoo right now but I am not sure how to get this to send the autogenerated link that is associated with the ID that is autogenerated already in my sql server database.Private Sub SendMail()        Dim emailSender As SmtpClient        Dim theMessage As MailMessage        Dim EmailAddress As String = txtEmailAddress.Text        emailSender = New System.Net.Mail.SmtpClient("ppicom")        theMessage = New MailMessage        theMessage.From = New MailAddress("PeerlessProductsInc @mail.com")        theMessage.To.Add(EmailAddress)        theMessage.

Email Encryption using System.Net.Mail assembly

Hi folks, Has anyone used the above assemblies to send emails using public key enryption, specifically PGP? Cheers Mark 

Token-based server access validation failed with an infrastructure error

Hi We have a new Win 2008 Enterprise x64 server running SQL 2008When we try to connect to the server using Windows Authentication, from a user account which is a domain administrator, we get the following message:"Token-based server access validation failed with an infrastructure error"What needs to be configured here for this to work ?ThanksBruce
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend