-
May 8th, 2007, 06:14 AM
#1
Thread Starter
New Member
VB Sendmail
Hey,
Can anyone point me in the right direction to some good sites with free scripts?
Im trying to send an email with an attachment - simply thou - the one iv got has got api/activex and sub classes/modules all over it.
Many thanks
---------------------------------------------------------------------------
There's a way around everything; even if it's the wrong way...
-
May 8th, 2007, 06:50 AM
#2
Re: VB Sendmail
you cold use automation to send through outlook, but i prefer the vbSendmail, which is very simple to use
you can use vbSendmail as a dll then just reference the dll
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
May 8th, 2007, 07:16 AM
#3
Thread Starter
New Member
Re: VB Sendmail
Hey, yeah iv had a look at vbSendmail but I have trouble compiling it. When trying to run it, it says something about activex? I dont know exact error until i get back home, but if you know of any issues?
Many thanks
---------------------------------------------------------------------------
There's a way around everything; even if it's the wrong way...
-
May 8th, 2007, 07:43 AM
#4
Thread Starter
New Member
Re: VB Sendmail
Also: why does vbsendmail save/get the information to the registry?
---------------------------------------------------------------------------
There's a way around everything; even if it's the wrong way...
-
May 8th, 2007, 09:21 AM
#5
Re: VB Sendmail
Because that's how it's written. You can change that if you don't like it.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
May 8th, 2007, 12:31 PM
#6
Re: VB Sendmail
I think vbSendmail needs to be in your Win\Sys folder and register it.
Last edited by Keithuk; May 9th, 2007 at 01:55 PM.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
May 8th, 2007, 03:48 PM
#7
Member
Re: VB Sendmail
This is what I use in all my apps...
Code:
' For Windows 2000 you need to add a reference to
'
' Microsoft CDONTS 1.2
'
' For Windows XP the reference needed is
'
' Microsoft CDO for Exchange 2000
'
Public Function SendMail() As Boolean
Dim iMsg
Dim iConf
Dim Flds
On Error GoTo Oops
' Windows XP or 2000?
If Environ("systemroot") = "C:\WINDOWS" Then ' Windows XP machine
Dim iMsg
Dim iConf
Dim Flds
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mailserver_IP_or_Name" ' <- change this
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "someone@somewhere.com"
.Bcc = "secret@somewhere.com"
.From = "whoever@somewhereelse.com"
.Subject = "This is the subject line"
.HTMLBody = Some_Variable
.AddAttachment ("c:\somefile.jpg")
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
Else
Dim NewMail As New CDONTS.NewMail
Set NewMail = CreateObject("CDONTS.NewMail")
NewMail.MailFormat = CdoMailFormatMime
NewMail.BodyFormat = CdoBodyFormatHTML
NewMail.From = "whoever@somewhereelse.com"
NewMail.Subject = "This is the subject line"
NewMail.Body = Some_Variable
NewMail.Bcc = "secret@somewhere.com"
NewMail.To = "someone@somewhere.com"
NewMail.AttachFile "c:\somefile.jpg"
NewMail.Send
Set NewMail = Nothing
End If
On Error Goto 0
SendMail = True
Exit Function
Oops:
SendMail = False
End Function
Hope it helps.
-
May 9th, 2007, 02:54 AM
#8
Thread Starter
New Member
Re: VB Sendmail
Thanks for everyones reply, it appears that i had to "regsvr32.exe vbSendMail.dll" from command which registered the dll. This then worked when compiling the app.
Thanks again
---------------------------------------------------------------------------
There's a way around everything; even if it's the wrong way...
-
Sep 24th, 2007, 05:41 AM
#9
Addicted Member
Re: VB Sendmail
Hey, you forgot password and login. Is it sample work through smtp?
-
Sep 24th, 2007, 06:17 AM
#10
Re: VB Sendmail
Originally Posted by Keithuk
I think vbSendmail needs to be in your Win\Sys folder and register it.
Originally Posted by Hardbyte
Thanks for everyones reply, it appears that i had to "regsvr32.exe vbSendMail.dll" from command which registered the dll. This then worked when compiling the app.
I told you to register it.
Keith
I've been programming with VB for 25 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning.
-
Sep 24th, 2007, 06:17 AM
#11
Re: VB Sendmail
Are looking for an smtp example of sending mail with VB6?
-
Sep 24th, 2007, 07:10 AM
#12
Addicted Member
Re: VB Sendmail
Yes, with smtp authorization.
-
Sep 24th, 2007, 07:12 AM
#13
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
|
Click Here to Expand Forum to Full Width
|