DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: vbSendMail

  1. #1
    Join Date
    Mar 2007
    Posts
    3

    vbSendMail

    I'm trying vbSendMail for the first time and have the follow code written
    [CODE
    Private Sub Send_Click()
    Set poSendMail = New clsSendMail
    poSendMail.UseAuthentication = True
    poSendMail.UsePopAuthentication = True
    poSendMail.POP3Host = "pop.earthlink.net"
    poSendMail.UserName = "lmyname"
    poSendMail.Password = "password"
    poSendMail.SMTPHost = cnp!ehost
    poSendMail.SMTPPort = 587
    poSendMail.From = "lmyname4@earthlink.net"
    poSendMail.FromDisplayName = cnp!Name
    poSendMail.Recipient = sendto
    poSendMail.RecipientDisplayName = "RCompany, LLC"
    poSendMail.ReplyToAddress = cnp!email
    poSendMail.Subject = "Research Request"
    poSendMail.Message = "This is a test"
    poSendMail.send
    End Sub
    Private Sub poSendMail_SendSuccesful()
    Stop
    MsgBox ("Mail Sent OK!")

    End Sub
    Private Sub poSendMail_SendFailed(Explanation As String)
    Stop
    ' vbSendMail 'SendFailed Event
    MsgBox ("Your attempt to send mail failed for the following reason(s): " & vbCrLf & Explanation)
    lblProgress = ""
    Screen.MousePointer = vbDefault
    cmdSend.Enabled = True

    End Sub
    [/CODE]

    But when I click the "Send" button, the click code executes but neither the SendFailed nor the SendSuccessful event is triggered. And the email doesn't reach the recipient.

  2. #2
    Join Date
    Aug 2005
    Posts
    85
    Firstly, I assume you have dimensioned poSendMail like this;

    Code:
    Private WithEvents poSendMail as vbSendMail.clsSendMail
    So, if the events trigger, you have cancelled what will happen by inserting the 'Stop' command;

    Code:
    Private Sub poSendMail_SendSuccesful()
        Stop
        MsgBox ("Mail Sent OK!")
    End Sub
    'Stop' stops programme execution at the current line.
    As to why you cannot send, I can only assume you have made a mistake with some of your data. Try the demo programme that came with VBSendMail and if it works, you know you did something wrong.

    I just downloaded and tried it, works fine for me so good luck. You will notice that there are no 'Stop' commands in the demo poSendMail events.

    Steve.

  3. #3
    Join Date
    Mar 2007
    Posts
    3
    Quote Originally Posted by Steve Grant
    Firstly, I assume you have dimensioned poSendMail like this;

    Code:
    Private WithEvents poSendMail as vbSendMail.clsSendMail
    So, if the events trigger, you have cancelled what will happen by inserting the 'Stop' command;

    Code:
    Private Sub poSendMail_SendSuccesful()
        Stop
        MsgBox ("Mail Sent OK!")
    End Sub
    'Stop' stops programme execution at the current line.
    As to why you cannot send, I can only assume you have made a mistake with some of your data. Try the demo programme that came with VBSendMail and if it works, you know you did something wrong.

    I just downloaded and tried it, works fine for me so good luck. You will notice that there are no 'Stop' commands in the demo poSendMail events.

    Steve.
    I use the "stop" as a debugging tool. The program isn't stopping so it is never reaching the "stop." It doesn't work without the "stop" anyway.

  4. #4
    Join Date
    Mar 2007
    Posts
    2
    My question is: vesendmail can't sent mail to USA, but it can send mial to CHINA. why?

Similar Threads

  1. Replies: 8
    Last Post: 03-07-2007, 01:06 PM
  2. Problem with vbSendMail
    By EricFrance in forum VB Classic
    Replies: 0
    Last Post: 03-06-2007, 07:18 PM
  3. How to send formatted text by vbsendmail?
    By Oscar99 in forum VB Classic
    Replies: 1
    Last Post: 07-30-2006, 11:15 AM
  4. vbsendmail component..where n how?
    By yuvarajvima in forum VB Classic
    Replies: 0
    Last Post: 02-05-2006, 02:28 PM
  5. vbSendMail DLL .Attachment Failure
    By ljwheeler in forum VB Classic
    Replies: 0
    Last Post: 07-28-2005, 11:07 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center