CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.faq_frequently_asked_questions Tags:
Item Type: NewsGroup Date Entered: 2/23/2008 12:25:35 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 7 Views: 63 Favorited: 0 Favorite
8 Items, 1 Pages 1 |< << Go >> >|
Ganesh@Nilgris
Asp.Net User
Sending email2/23/2008 12:25:35 PM

0

 I am trying to send email based on the article

http://msdn2.microsoft.com/en-us/vbasic/bb630227.aspx

i have added the relavnt namespace but i could get the "smtpserver" and i want the equivalent code in c#

Dim SMTPServer As New SmtpClient("SMTP Server here")

SMTPServer.Send(MyMailMessage)

Any ideas?

 


Jai Ganesh. J , GSD ,India

Please Mark As Answer If my reply helped you.
dotnetbohn
Asp.Net User
Re: Sending email2/23/2008 2:07:23 PM

0

Try

SmtpClient SMTPServer = new("SMTP Server here");

SMTPServer.Send(MyMailMessage);

 

Make sure you have this at the top of you code;

using System.Net.Mail; 


Matt
Chief Architect
Software Engineer
Smooth Fusion, Inc.
http://www.smoothfusion.com
bnarasimha
Asp.Net User
Re: Sending email2/24/2008 6:07:25 PM

0

Hey

SMTPServer is a property of SmtpMail which is available under System.Web.Mail

ex: SmtpMail.SmtpServer

 

In the link you are referring SMTPServer is an object of type SmtpClient.

this is not same as above SMTPServer

 


 


Narasimha

"Mark as Answer" the post which helped you in solving your problem
mclead99
Asp.Net User
Re: Sending email2/24/2008 6:09:27 PM

0

 

Great site with the answers you need

http://www.systemnetmail.com/faq.aspx

Others have also found this useful

 http://forums.asp.net/p/1162734/1926591.aspx#1926591

dotnetbohn
Asp.Net User
Re: Sending email2/25/2008 4:46:26 AM

0

Yes,  System.Web.Mail was used in ASP.NET 1.1.  System.Net.Mail is typically used in ASP.NET 2.0


Matt
Chief Architect
Software Engineer
Smooth Fusion, Inc.
http://www.smoothfusion.com
syed rizwan iqb
Asp.Net User
Re: Sending email using SMTP server2/25/2008 5:37:34 PM

0

some time SMPT server did't work.

1.Go to Control Panel -> Administrative tools -> IIS

2. Right Click on the Smtp Server which is at the bottom and select properties.

3. Select the Access Tab.

4.Select the Relay option

5.Check the radio button which says use only listed below and add your localhost address to it which is "127.0.0.1".

or Check the Radio Button All except list below.

i write one code its registration form and at click on Register button that code work and send info to database and send email too. as well as load the thanks page too.

Ganesh@Nilgris:

 I am trying to send email based on the article

http://msdn2.microsoft.com/en-us/vbasic/bb630227.aspx

i have added the relavnt namespace but i could get the "smtpserver" and i want the equivalent code in c#

Dim SMTPServer As New SmtpClient("SMTP Server here")

SMTPServer.Send(MyMailMessage)

Any ideas?

 

************************************************************Code*****************************************************

using System;

using System.Collections;

using System.ComponentModel;

using System.Configuration;

using System.Data;

using System.Linq;

using System.Web;

using System.Web.Security;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.HtmlControls;

using System.Web.UI.WebControls;

using System.Web.UI.WebControls.WebParts;

using System.Xml.Linq;

using System.Data.OleDb;

using System.Data.SqlClient;

using System.Data.ProviderBase;

using System.Web.Mail;namespace WebApplication3

{

public partial class _Default : System.Web.UI.Page

{

protected void Page_Load(object sender, EventArgs e)

{

 

T6.Text =
DateTime.Now.ToString();T7.Text = "Baass new taraining";

 

}

 

protected void Button1_Click1(object sender, EventArgs e)

{

 

 

string sr = "";

SqlConnection conn = new SqlConnection(

"Data source=SYED-PC;Initial Catalog=baass;Integrated Security=True");

conn.Open();

sr =
"insert into Registrations (Name,Company,Phone,Email,Details,Date,Event,Location,EventCode,EventDate,EventTime) values ('" + Request.Form.Get("T1").ToString() + "','" + Request.Form.Get("T2").ToString() + "','" + Request.Form.Get("T3").ToString() + "','" + Request.Form.Get("T4").ToString() + "','" + Request.Form.Get("T5").ToString() + "','" + Request.Form.Get("T6") + "','"+Request.Form.Get("T7") +"','toronto','Event of 2008','03/15/2008','09:30:00 AM')";

 

 

SqlCommand md = new SqlCommand(sr, conn);

int y = md.ExecuteNonQuery();

//int x = md.ExecuteNonQuery();

conn.Close();

MailMessage mails = new MailMessage();

mails.To = T4.Text;

mails.Bcc =
[email protected];

mails.From = [email protected];

mails.Subject = "Registration Detail : " + T1.Text;

mails.Body = "Welcome " + T1.Text + " " +","+

"your Event code is EVENT of march 2008, " +

" Location is: Toronto , " +

" Starting Date: Mar,15 2008 at 9:30 am , " +

" If you have any Question Call at: 1800-000-0000 ";

SmtpMail.SmtpServer = "localhost";SmtpMail.Send(mails);

 

Response.Redirect(
"Thanks.aspx");

}

}

}

Nagashree
Asp.Net User
How to include java script in a content page of masterpage2/26/2008 9:08:10 AM

0

How to include java script in a content page of masterpage and how do I call those functions in .cs file of my asp.net website?

I tried all the combinations of previous answers in this site? but, no results.

Please help me out with this as soon as possible.

vijaymann1
Asp.Net User
Re: Sending email2/27/2008 10:09:35 AM

0

gud one
Vijay Mann
Software Developer Noida India
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:




   
  Privacy | Contact Us
All Times Are GMT