Announcement Announcement Module
Collapse

myhosting.com Forum Guidelines

Welcome to the myhosting.com Forums! The purpose of this forum is to allow you to discuss topics relating to hosting and topics of interest with other myhosting.com Customers. The primary focus should relate to issues not generally included in our Wiki or Control Panel, or information not provided by our Customer Support Team. Some examples include programming and coding support, web site design ideas and SEO practices.

The forum is not meant as a replacement to our Wiki or Customer Support. We highly recommend searching our Wiki before posting on the forum. Also, if you have a question for our Customer Support team, please contact them as you would normally.

We ask that if you have any complaints or questions relating specifically to your account, that you address them to our Customer Support department. Do not post personal account information such as passwords or other sensitive and private information the forum, as this type of information is best kept secret. Also, please be respectful of other users and refrain from defamatory comments or use of coarse language.

We will visit the forum from time to time, and contribute to various topics. We reserve the right to delete any posts which are deemed offensive or against the spirit of the forum. Any spamming or illegal activity will not be tolerated. We also reserve the right to block any user who violates these guidelines.

To get started, we welcome you to sign up at our User Management site. Any account created there will have access to these forums, our Wiki, our Ideas site and commenting permission on our Status Blog.
See more
See less
Batch Email with JMail - Failing Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch Email with JMail - Failing

    Hello,

    Im using JMail.Message v4.5 to send out batch emails (20 recipients per email) to a list of members (its a newsletter).

    The function generates a list of member emails from a database, it then loops through each address adding it to the BCC field. Once the BCC field contains 20 recipients the email is sent and the recipient list is cleared ready for the next 20. This repeats until all members have been emailed.

    The function works fine when all email addresses are valid, however should it come across an invalid email (maybe the member has switched ISPs, etc) the function fails and no emails are sent.

    Im coding in VBScript on a shared windows hosting account. The code Im using is shown below, please note I have changed the name of the domain, email accounts and passwords for obvious reasons, as well as simplified the [loop] and [if] constructs:

    Code:
    Dim objJMail
    Set objJMail = Server.CreateObject("JMail.Message")
    objJMail.Logging = True
    objJMail.Silent = True
    objJMail.From = "me@mydomain.com"
    objJMail.FromName = "Me at My Website"
    objJMail.MailServerUserName = "admin@mydomain.com"
    objJMail.MailServerPassword = "dummy_password"
    objJMail.Priority = 3
    objJMail.Subject = "Subject Title"
    objJMail.Body = "Message Body"
    
    [loop through email addresses]
    
        objJmail.AddRecipientBCC [recipient_email_address]
    
         [if 20 recipients - send email, clear recipient list]
    
            blSuccess = objJMail.Send("mail.mydomain.com")
            objJMail.ClearRecipients()
    
         [end if]
    
    [end loop]
    
    ' Finished looping through recipients - send final email
    blSuccess = objJMail.Send("mail.mydomain.com")
    
    ' Tidy Up JMail object
    objJMail.Close
    Set objJMail = Nothing
    Note: I've also tried removing the following and it still fails:
    Code:
    objJMail.MailServerUserName = "admin@mydomain.com"
    objJMail.MailServerPassword = "dummy_password"
    The error information for this is below:
    Code:
    JMail ErrorCode: 554
    JMail ErrorMessage:
    The message was undeliverable. All servers failed to receive the message

    I've tried the function with a sample list containing 2 email addresses, one is invalid (batman@mydomain.com) and the other is fine (legit@mydomain.com). The JMail Log shows the following:
    Code:
    The message was undeliverable. All servers failed to receive the message
    
    .execute()
    {
    Trying server mail:mail.mydomain.com
    <- 220 xmail02.myhosting.com ESMTP 648143d3667b3045487bb901cdbbf649 ->
    
    EHLO web3002.ad1.softcom.biz
    <- 250-xmail02.myhosting.com 250-PIPELINING 250-SIZE 100000000 250-DATAZ 250-AUTH LOGIN PLAIN 250 8BITMIME ->
    
    AUTH LOGIN Sending authentication data..->
    
    MAIL FROM:
    <- 250 ok ->
    
    RCPT TO:batman@mydomain.com
    <- 554 Sorry, no mailbox here by that name. (#5.1.1) ->
    
    RCPT TO:legit@mydomain.com
    Error: Connection reset by client.
    
    .execute()
    {
    Trying server mail:mail.mydomain.com
    <- 220 xmail02.myhosting.com ESMTP 648143d3667b3045487bb901cdbbf649 ->
    
    EHLO web3002.ad1.softcom.biz
    <- 250-xmail02.myhosting.com 250-PIPELINING 250-SIZE 100000000 250-DATAZ 250-AUTH LOGIN PLAIN 250 8BITMIME ->
    
    AUTH LOGIN Sending authentication data.. ->
    
    MAIL FROM:
    <- 250 ok ->
    
    RCPT TO:batman@mydomain.com
    <- 554 Sorry, no mailbox here by that name. (#5.1.1) ->
    
    RCPT TO:legit@mydomain.com
    Error: Connection reset by client. 1 of 1 servers failed
    }
    
    }
    Anyone have any ideas?

    What I want it to do is ignore any invalid emails and continue. For some reason, after the invalid email attempt is aborted, when it tries to send to the legit recipient that is next in the list, it fails as the connection is reset.

    Cheers
    Simon

  • #2
    Re: Batch Email with JMail - Failing

    ok, looks like i was going about it the hard way ops:

    I've now altered the code to make use of the MailMerge component of JMail, the following seems to work:

    Code:
    Dim objJMail
    Set objJMail = Server.CreateObject("JMail.Message")
    objJMail.Logging = true
    objJMail.Silent = true
    objJMail.Priority = 3
    objJMail.From = "me@mydomain.com"
    objJMail.FromName = "Me at my Website"
    objJMail.Subject = "Subject"
    objJMail.Body = "Message Body"
    objJmail.AddRecipient "%%fld_Email%%"
    		
    ' Create JMail MailMerge object
    Dim objMailMerge
    Set objMailMerge = Server.CreateObject( "JMail.MailMerge" )
    objMailMerge.MailTemplate = objJMail
    		
    [query DB - get email address list in recordset - objRS]
    If Not objRS.EOF Then
    	objMailMerge.BulkMerge objRS, false, "mail.mydomain.com"
    End If
    		
    [ Release ADO/JMail Objects]
    Seems to work well.

    Comment


    • #3
      Re: Batch Email with JMail - Failing

      Glad to hear you were able to figure it out on your own. And thanks for posting your solution here, it may help someone in the future

      Comment

      Working...
      X