Sending mail in C# with or without smtp
-
Hi firends,im working with webform of C#.I would like to send mail with or without smtpserver.please kindly send me the code with explanation.Thank you in advance.
Hi,Im Razana
-
Hi firends,im working with webform of C#.I would like to send mail with or without smtpserver.please kindly send me the code with explanation.Thank you in advance.
Hi,Im Razana
Hey Razana. YOu need to specify what version of C# you're using. But, you'd do better to type it directly into google. There are tons of examples on this on the web. Of course, without a server, you can't send mail, it's not possible.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hey Razana. YOu need to specify what version of C# you're using. But, you'd do better to type it directly into google. There are tons of examples on this on the web. Of course, without a server, you can't send mail, it's not possible.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
Hi friends this is the error what im receiving in my application. Server Error in '/afxisityro' Application. -------------------------------------------------------------------------------- The transport failed to connect to the server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server. Source Error: Line 35: Line 36: SmtpMail.SmtpServer="afxisi.com"; //your real server goes here Line 37: SmtpMail.Send(mail); Line 38: // Put user code to initialize the page here Line 39: Source File: c:\inetpub\wwwroot\afxisityro\sendmail.aspx.cs Line: 37 These are the code what im using in my web application MailMessage mail=new MailMessage(); mail.From ="rinooza@gmail.com"; mail.To="razanabanu@gmail.com"; mail.Subject ="HI"; mail.Priority =MailPriority.Normal ; mail.BodyFormat =MailFormat.Html ; mail.Body="Hi! "; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "rojabanu.m@afxisi.co.in"); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "8A4904"); //set your password here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "false"); SmtpMail.SmtpServer="afxisi.com"; //your real server goes here SmtpMail.Send(mail); // Put user code to initialize the page here
Hi,Im Razana
-
Hi friends this is the error what im receiving in my application. Server Error in '/afxisityro' Application. -------------------------------------------------------------------------------- The transport failed to connect to the server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server. Source Error: Line 35: Line 36: SmtpMail.SmtpServer="afxisi.com"; //your real server goes here Line 37: SmtpMail.Send(mail); Line 38: // Put user code to initialize the page here Line 39: Source File: c:\inetpub\wwwroot\afxisityro\sendmail.aspx.cs Line: 37 These are the code what im using in my web application MailMessage mail=new MailMessage(); mail.From ="rinooza@gmail.com"; mail.To="razanabanu@gmail.com"; mail.Subject ="HI"; mail.Priority =MailPriority.Normal ; mail.BodyFormat =MailFormat.Html ; mail.Body="Hi! "; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "rojabanu.m@afxisi.co.in"); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "8A4904"); //set your password here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "false"); SmtpMail.SmtpServer="afxisi.com"; //your real server goes here SmtpMail.Send(mail); // Put user code to initialize the page here
Hi,Im Razana
razanabanu wrote:
SmtpMail.SmtpServer="afxisi.com"; //your real server goes here
Gee - did it occur to you to read the comments and put a real mail server in there ? Like I said, you cannot send mail without a server.
Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
-
Hi friends this is the error what im receiving in my application. Server Error in '/afxisityro' Application. -------------------------------------------------------------------------------- The transport failed to connect to the server. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server. Source Error: Line 35: Line 36: SmtpMail.SmtpServer="afxisi.com"; //your real server goes here Line 37: SmtpMail.Send(mail); Line 38: // Put user code to initialize the page here Line 39: Source File: c:\inetpub\wwwroot\afxisityro\sendmail.aspx.cs Line: 37 These are the code what im using in my web application MailMessage mail=new MailMessage(); mail.From ="rinooza@gmail.com"; mail.To="razanabanu@gmail.com"; mail.Subject ="HI"; mail.Priority =MailPriority.Normal ; mail.BodyFormat =MailFormat.Html ; mail.Body="Hi! "; mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", "465"); mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); //basic authentication mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "rojabanu.m@afxisi.co.in"); //set your username here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "8A4904"); //set your password here mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", "false"); SmtpMail.SmtpServer="afxisi.com"; //your real server goes here SmtpMail.Send(mail); // Put user code to initialize the page here
Hi,Im Razana
Have a chat with your mail server administrators to ensure you have the correct mail server name and port. Also check that traffic on this port is not blocked from PCs in your organisation. Where I work, I cannot connect to the SMTP server from my PC, I have to use a development server when I want to test the sending of emails. :^)
Declan Bright www.declanbright.com