Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "Using dll to send email - Multithreading" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Reply « Previous Thread | Next Thread »  
 
LinkBack Thread Tools Display Modes
  #1  
Old August 4th, 2008, 10:01 AM
Barn Newbie

 
Join Date: May 2008
Location: South Wales
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 1
sync_or_swim is an unknown quantity at this point

Awards Showcase
Classic ASP 
Total Awards: 1

Default Using dll to send email - Multithreading

Hi Guys,

I have been searching for a solution for a while but haven't made any headway, if anyone could give me any ideas I would be extremely grateful.

The scenario is that I have been using CDOSYS to send automated emails from a number of Intranet pages within my organisation. Everything worked fine until a month or so ago, when we installed a new servicepack to our email system - Novell Groupwise.

Since the upgrade, automatic emails intermittently fail, with the error:

CDO.Message.1 error '80040213'

The transport failed to connect to the server.

/nmdb/checkform.asp, line 41

Line 41 is the Line "cdoMessage.Send"

After much experimentation, I found that, because I am sending the message directly to the smtp server and bypassing the mail sweeper, the smtp server assumes that the mail should come from an external domain - if it does not come from an external domain, the email is blocked. I suppose this makes sense because it means that I cant create an email saying that everyone has had a pay rise and pretend that it came from the MD!!!

Unfortunately, some emails are still failing for no apparaent reason. To combat this I have created a VB6 dll to re-send the email if it fails, the code within the dll is:
Code:
Private Sub doSend(strTo, strFrom, strSubject, strMessage, strAttachment)
On Error GoTo ErrorHandler
    
    Set imsg = CreateObject("cdo.message")
    Set iconf = CreateObject("cdo.configuration")
    Set Flds = iconf.Fields
    With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = 'IP Address of SMTP Server
        .Update
    End With
    Dim strReceiveremail, strFrom, strSubject, strHTML As String
      
    With imsg
        Set .Configuration = iconf
        .To = strTo
        .From = strFrom
        .Subject = strSubject
        .HTMLBody = strMessage
        .Fields.Update
        .AddAttachment (strAttachement)
        .Send
    End With
    Set imsg = Nothing
    Set iconf = Nothing
ErrorHandler:
    If Err.Number <> 0 Then
        
        While Err.Number <> 0
            Call doSend
        Wend
        Unload Me
    End If
End Sub
I have registered the dll on the server and I can call the doSend function from my asp pages with the following code:
Code:
<%
Dim strMessage
strMessage = Request.Form("Full_Name") & vbVerticalTab & vbCrLf & "Submitted Feedback on " & Date & vbCr & "------------------------" & vbCrLf & "Question: " & Request.Form("Question")
Dim objSendMail
Set objSendMail = Server.CreateObject("AutoEMail.Class1")
call objSendMail.doSend("sync_or_swim@test.co.uk", "someaddress@fakedomain.co.uk", "User Feedback Submitted", strMessage)
Set objSendMail = Nothing
Response.Write("Thank you. Your message has been sent to the Database Administrator")
%>
This is working, insomuch as all of my emails are being sent - the function is re-trying until they get through. My problem is that the page has to wait for the email to be sent until it can continue to load which may take 30 seconds.

And now for my question, finally!!!

Is there any way that I can call my dll from the asp page so that it runs in the background? Ie. So that it keeps trying to resend the message, but passes control back to the asp pages straight away so that I can do something else and the user doesn't have to wait for the email to send and there is no delay in the page loading.

Does anybody know if this is possible or am I on a wild goose chase?
Reply With Quote
Sponsored Links
  #2  
Old August 4th, 2008, 10:15 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 820
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft Windows Microsoft .Net Microsoft SQL Server Classic ASP 
Total Awards: 4

Default

Regarding the original problem...can't you point your script to relay through the Groupwise server to see if that will solve the problem?

Regarding your question, I'm not sure if that's even possible.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
Reply With Quote
Reply

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Email] Simple way to email form Rebelle ASP Development 17 August 14th, 2008 04:03 PM
send Bulk email peebman2000 .Net Development 2 June 20th, 2008 10:06 AM
windows service send emails every 10 days peebman2000 .Net Development 8 May 20th, 2008 04:00 PM
[VBScript] VBS Send Mail keep_it_simple Windows Scripting 0 March 22nd, 2008 11:58 AM


All times are GMT -4. The time now is 04:51 PM.



Content Relevant URLs by vBSEO 3.2.0