-
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.
-
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.
-
 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.
-
My question is: vesendmail can't sent mail to USA, but it can send mial to CHINA. why?
Similar Threads
-
By gatorstudios in forum VB Classic
Replies: 8
Last Post: 03-07-2007, 01:06 PM
-
By EricFrance in forum VB Classic
Replies: 0
Last Post: 03-06-2007, 07:18 PM
-
By Oscar99 in forum VB Classic
Replies: 1
Last Post: 07-30-2006, 11:15 AM
-
By yuvarajvima in forum VB Classic
Replies: 0
Last Post: 02-05-2006, 02:28 PM
-
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
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|