Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 27th, 2013, 11:25 AM
Registered User
Points: 52, Level: 1
Points: 52, Level: 1 Points: 52, Level: 1 Points: 52, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2013
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default hello I need help with sending a mail trough webform

hello this is the code i am using:

private String SendMail(String CorreoDestino, String Asunto, String Cuerpo)
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("hp88.hostpapa.com");
mail.From = new MailAddress("mailadress@mail.com", "Host", Encoding.UTF8);
mail.Subject = Subject;
mail.Body = Body;
mail.To.Add(CorreoDestino);
SmtpServer.Port = 25;
SmtpServer.Credentials = new System.Net.NetworkCredential("emailsender@mail.com ", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
return "Enviado";
}

catch (Exception ex)
{
return ex.Message.ToString();
}


the sender button:

protected void btnEnviar_Click(object sender, EventArgs e)
{
string TextToSend = txtTextToSend.Text;
String MenConfirmacion = "";
MenConfirmacion = SendMail("MailDestiny@mail.com", "e-mai header", TextToSend);
lblmen.Text = Mensaje;
}
Reply With Quote
  #2 (permalink)  
Old September 28th, 2013, 09:36 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
this is the code i am using:
And what about describing what the actual problem is?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
light882 (October 2nd, 2013)
  #3 (permalink)  
Old September 30th, 2013, 11:15 AM
Registered User
Points: 52, Level: 1
Points: 52, Level: 1 Points: 52, Level: 1 Points: 52, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2013
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Smile thnx for the reply

the problem is that the code doesn´t show any error but the email is not send, thnx for your help
Reply With Quote
  #4 (permalink)  
Old September 30th, 2013, 01:32 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Try removing the try/catch block and see what the real error is. My guess is that it has to do with the configuration of the server, user name, password or port (for example, SSL and port 25 probably won't work together). Without the real error, it's hard to tell what's going on.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
light882 (October 2nd, 2013)
  #5 (permalink)  
Old October 2nd, 2013, 03:32 PM
Registered User
Points: 52, Level: 1
Points: 52, Level: 1 Points: 52, Level: 1 Points: 52, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2013
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Post yes the change of the port was the result thank you

it worked because on the proyect the mail was on a diferent port, thank you very much, I have another question, please I want to know how to make an pageIndex on a gridview, I´m using this code:


protected void dtgBusqueda_SelectedIndexChanging(object sender, GridViewPageEventArgs e)
{
dtgBusqueda.PageIndex = e.NewPageIndex;
ViewState["Busqueda"] = Session["oTransaction"];
//filling the gridview
dtgBusqueda.DataSource = (DataTable)ViewState["Busqueda"];

}

when i do this the GridViewPageEventArgs changes for a GridViewSelectEventArgs again and I don´t know why
Reply With Quote
  #6 (permalink)  
Old December 4th, 2013, 06:02 AM
Registered User
Points: 6, Level: 1
Points: 6, Level: 1 Points: 6, Level: 1 Points: 6, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you
Reply With Quote
  #7 (permalink)  
Old December 7th, 2013, 07:55 AM
Authorized User
 
Join Date: Nov 2013
Location: Fort Worth
Posts: 10
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think that has gotten a little over the top and also a bit complicated.
__________________
123movies
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
mail sending PHP FAQs 0 April 2nd, 2007 06:43 AM
problems sending mail with java mail gandacuboy J2EE 2 December 20th, 2006 03:05 PM
Sending e-mail to different mail box! Calibus Classic ASP Databases 4 September 3rd, 2004 05:48 PM
sending an e-mail Calibus Classic ASP Databases 3 August 22nd, 2004 07:45 PM
Sending both text mail and HTML mail - CDONTS madhukp Classic ASP Basics 1 October 8th, 2003 01:05 AM



All times are GMT -4. The time now is 11:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.