Solved

Alternative to a reporting tool?

Posted on 2011-09-26
10
176 Views
Last Modified: 2012-08-14
I'm up against a deadline and am having way too much difficulty finding a simple free reporting solution to my ASP .NET 3.5 [C#] web application. So in an effort to "come up with something" i'm now playing with  the idea of creating a formatted message and just sending that formatted message through an email. So,...I'm now looking for code examples or links that point to examples of how to do this? Any help would be appreciated. If it adds any help to the solution, i'm running my web app from / through a goDaddy server. Thanks.
0
Comment
Question by:mikesExpertExchange
  • 6
  • 4
10 Comments
 
LVL 32

Expert Comment

by:Big Monty
ID: 36599859
here's a simple tutorial on how to send emails:

http://www.systemwebmail.com/faq/2.2.aspx
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 36599878
if you need to use authentication, this thread also explains it well:

http://social.msdn.microsoft.com/Forums/en/netfxnetcom/thread/a75533eb-131b-4ff3-a3b2-b6df87c25cc8
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36600873
@The Big Daddy: so how do i make sure that I'm set up correctly to send email from my HostIPAddress or smptserver? i'm getting a socket operation error: "A socket operation was attempted to an unreachable network xxx.xxx.x.x:25". and for some reason there is a :25 attached to the end of my IP octet. Not sure why or what this error means. I went and ran the "ipconfig /all" command from the command prompt to get my DNS server IP address. and when i put that in my code for my local host, as in the sample code above, it bombed out with the error mentioned above.

i had to alter the code a bit,...(see code attached). i set the HostIPAddress to the ip address i found when i ran the ipconfig /all command
MailAddress toAddress = new MailAddress("toAddress@gmail.com");
        MailAddress fromAddress = new MailAddress("fromAddress@gmail.com");

        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage(fromAddress, toAddress);
        //mail.To.Add(toAddress);
        //mail.From.Address;
        mail.Subject = "this is a test email.";
        mail.IsBodyHtml = true;
        mail.Body = "this is my test email body.<br><b>this part is in bold</b>";

        using (SmtpClient client = new SmtpClient(String.IsNullOrEmpty(smtpserver) ? HostIPAddress : smtpserver)) //your real server goes here
        {
            client.Send(mail);

        }

Open in new window

0
 
LVL 32

Accepted Solution

by:
Big Monty earned 500 total points
ID: 36601080
since you're hosting on GoDaddy, you'll need to use their servers to send out the email. After some digging around, I found this article:

http://help.godaddy.com/article/1073

Note you cant use gMail addresses to send emails.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601330
ok,...I will check that link for when I start testing on goDaddy. for now, the problem I described above, is happening as I try to test the code on my machine, my laptop. I'm using a wireless connection, if that makes any difference.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601656
this is the copied and pasted text of the error i'm getting (see code snippet). above, when you mentioned that i couldn't send email from my gMail account, was that pertaining only to if i was / would be trying to send an e-mail through the goDaddy server(s)?
Server Error in '/' Application.
A socket operation was attempted to an unreachable network xxx.xxx.x.xxx:25
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.Net.Sockets.SocketException: A socket operation was attempted to an unreachable network 192.168.1.100:25

Source Error:

Line 1607:        SmtpClient client = new SmtpClient(HostIPAddress); //your real server goes here
Line 1608:
Line 1609:            client.Send(mail);
Line 1610:
Line 1611:        if (rbtnLockPassword.Checked)


Source File: c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs    Line: 1609

Stack Trace:

[SocketException (0x2743): A socket operation was attempted to an unreachable network 192.168.1.100:25]
   System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +239
   System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +35
   System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +224

[WebException: Unable to connect to the remote server]
   System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +5495895
   System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +202
   System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +21
   System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +332
   System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +160
   System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +159
   System.Net.Mail.SmtpClient.GetConnection() +35
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1213

[SmtpException: Failure sending mail.]
   System.Net.Mail.SmtpClient.Send(MailMessage message) +1531
   _Default.StudentSignInOut() in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1609
   _Default.btnSignIn_click(Object sender, EventArgs e) in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1540
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

Open in new window

0
 
LVL 32

Expert Comment

by:Big Monty
ID: 36601827
thats correct, GD doesnt allow it for some reason.

the error you're getting is basically saying the address you provided is incorrect. Whether its the port number(25) thats throwing it off or just the wrong IP, im not sure, you'll have to play around with it. did you try using just localhost as your address with the latest example I gave you?
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601835
if you mean actually putting in the string: "localhost" no i didn't / haven't. but i will now and let you know what happens...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36601929
i got a transport error when i tried it with "localhost"
Server Error in '/' 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 1610:        SmtpMail.SmtpServer = "localhost"; //your real server goes here
Line 1611:
Line 1612:        SmtpMail.Send(mail);
Line 1613:        
Line 1614:


Source File: c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs    Line: 1612

Stack Trace:

[COMException (0x80040213): The transport failed to connect to the server.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
   System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams) +337
   System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture) +36
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Type type, Object obj, String methodName, Object[] args) +66
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +49

[HttpException (0x80004005): The transport failed to connect to the server.
]
   System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +99
   System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1738
   System.Web.Mail.SmtpMail.Send(MailMessage message) +273
   _Default.StudentSignInOut() in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1612
   _Default.btnSignIn_click(Object sender, EventArgs e) in c:\src\StudyTimeTrackerPrimeI\Default.aspx.cs:1540
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


Version Information: Microsoft .NET Framework Version:2.0.50727.5446; ASP.NET Version:2.0.50727.5420

Open in new window

0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 36967986
thanks for your help
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now