Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 14th, 2007, 06:03 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default force email to go

hello,

i use this funtion to send email when a user click in button.

Code:
Imports System.Web.Mail


    Private Sub SendEmail()
        Const SERVER As String = "relay-hosting.secureserver.net"
        Dim oMail As MailMessage = New System.Web.Mail.MailMessage
        oMail.From = "emailaddress@domainname"
        oMail.To = "emailaddress@domainname"
        oMail.Subject = "Test email subject"
        oMail.BodyFormat = MailFormat.Html
        ' enumeration
        oMail.Priority = MailPriority.High
        ' enumeration
        oMail.Body = ("Sent at: " + DateTime.Now)
        SmtpMail.SmtpServer = SERVER
       Try
        SmtpMail.Send(oMail)
       Catch
        Result.text = "The mail couldn´t be sent !!"
       End Try
        oMail = Nothing
        ' free up resources
    End Sub
But sometimes the mail is not sent...
I think it's because "smtp server"
I have to click several times in button to see mail going out...

It is possible to make a cycle of 10 or 20 times to try to send the mail, and in case of sucess stops the cicle?

Thanks very much!

I use this for register page of my forum... and sometimes the users don't receive email's!

It's very boring,

Max

 
Old January 16th, 2007, 06:03 AM
Registered User
 
Join Date: Jan 2007
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sure it is possible to build such a loop around the sending part but how many times would you try to send? Moreover is there an exception thrown, if the mail is not sent?

I would try a different mail server. Also check the current server if it receives the messages or if the server recycles them (spam/junk).
 
Old January 16th, 2007, 10:42 AM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Also check the current server if it receives the messages or if the server recycles them (spam/junk).
How can i do that?

I have my site in goDaddy and i use them stmp server!

When I told them my problem they say that stmp server is ok... to Check my code!

But my code it's simple, and i think it's fine!

If my code was wrong i couldn't send my mail at the to fourth or the fifth time that I click in the button, right?

 
Old January 16th, 2007, 11:11 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Is your Catch statement executing, e.g. is there an error that is being thrown?

-----------------------------------------------------------
I will only tell you how to do it, not do it for you.------------
Unless, of course, you want to hire me to do work for you.---
^^Thats my signature--------------------------------------
-----------------------------------------------------------
http://www.catb.org/~esr/faqs/smart-questions.html -------
^^Took that from planoie's profile--------------------------
-----------------------------------------------------------
 
Old January 17th, 2007, 09:04 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply!

Yes, the catch throw this:

"System.Web.HttpException: Could not access 'CDO.Message' object. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Runtime.InteropServices.COMException (0x80040213): An imperfection in the linking of the transport to the server occurred. --- End of inner exception stack trace --- at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) at System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) --- End of inner exception stack trace --- at System.Web.Mail.LateBoundAccessHelper.CallMethod(O bject obj, String methodName, Object[] args) at System.Web.Mail.CdoSysHelper.Send(MailMessage message) at System.Web.Mail.SmtpMail.Send(MailMessage message) at Maxim.WebModules.Accounts.Web.registostemp.enviaMa ilEnviar_Click(Object sender, EventArgs e)"

 
Old January 17th, 2007, 09:27 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Your mailing through an open relay :shudders: sounds like your writing a Spam program. In any case I am not fimilar with this error or what is causing it, try and google it.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile
================================================== =========
 
Old January 17th, 2007, 11:05 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i don't think it's spam...

In my local computer i have the same application running, but here i have no mail configured.
So, when i click in a button, there are no vaid smtp server to provide outgoing email! But the error is the same.

I really think the godaddy smtp server is full of requests but they don't admit that!
If it's spam problem, or email.body problem i never had sucess send mails, but i have sucess at 4ª or 5ª time that i click in button.

since godaddy don't assume the problem and i have no money to request a personal smtp server:
make a cycle isn't the best way to solve the problem?

Thanks!

 
Old January 18th, 2007, 12:12 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

relay-hosting.secureserver.net that is the server you are using not godaddys. What you need to consider is that you are connecting to a remote SMTP server from godaddys Webserver, what I would check to see is if you are having problems connecting to that Mail server from godaddys webserver.

What I might try doing is using gmails mail server ot send the email (You have to have a Gmail account to even consider this tho) and try sending the email through there and just supply your gmail credientials.

See if you have the same problems.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile
================================================== =========
 
Old January 18th, 2007, 08:52 PM
Friend of Wrox
 
Join Date: Mar 2006
Posts: 310
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Are you saing that i can make a free gmail account and use it to send smtp mails from my asp.net application?

They provide this?

I will find a way to this and i will writte here the results!

Thanks,
Max

 
Old January 18th, 2007, 08:54 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Gmail is an invite only service (In the USA anyway) and, i dont suggest, using their mail server as your bulk mail server, although it could be done.

================================================== =========
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from planoie's profile^^
^^Modified text taken from gbianchi profile^^
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
Force ActiveMdiChild gbyrkje VB.NET 1 October 8th, 2004 04:55 PM
force macros enable helmekki Excel VBA 1 August 14th, 2004 06:18 AM
How To Force Column To Text ritag Excel VBA 12 August 13th, 2004 04:36 PM
Force A File To download harpua Javascript How-To 2 June 23rd, 2004 02:03 PM
force Page_Load miguel.ossa ASP.NET 1.0 and 1.1 Basics 7 January 23rd, 2004 06:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.