Connecting Tech Pros Worldwide Forums | Help | Site Map

User defined type not defined

Ronny Sigo
Guest
 
Posts: n/a
#1: Nov 12 '05
Hello all,
I am trying to write a prog that autamatically sends emails ...
Here is what I have done so far
In the module section I have put this:

Public Function SendEmail(email As String, subject As String, body As
String, attach As String)

Dim Mail As MailSender
Set Mail = New MailSender
Mail.Host = "relay.skynet.be"
Mail.From = "my.emailaddress@myprovider.be"
Mail.AddAddress (email)
Mail.subject = subject
Mail.body = body
Mail.AddAttachment (attach)

Mail.Send

End Function

Then in the program I assign values to the variables email,subject and body
Next I call the function ...
x = SendEmail(email, subject, body + Chr(13) + "Test", "c:\log.txt")
on running it I get this err-message:
User defined type not defined
How do I solve this , Can anybody help me with that ?
Any suggestions very much appreciated

Ronny Sigo



Douglas J. Steele
Guest
 
Posts: n/a
#2: Nov 12 '05

re: User defined type not defined


What is MailSender? To declare something like that, you either need to have
a reference set to an ActiveX component by that name, or else have a Class
with that name in your application.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(No private e-mails, please)



"Ronny Sigo" <ronny.sigo@example.invalid> wrote in message
news:3fbf91e8$0$28306$ba620e4c@reader1.news.skynet .be...[color=blue]
> Hello all,
> I am trying to write a prog that autamatically sends emails ...
> Here is what I have done so far
> In the module section I have put this:
>
> Public Function SendEmail(email As String, subject As String, body As
> String, attach As String)
>
> Dim Mail As MailSender
> Set Mail = New MailSender
> Mail.Host = "relay.skynet.be"
> Mail.From = "my.emailaddress@myprovider.be"
> Mail.AddAddress (email)
> Mail.subject = subject
> Mail.body = body
> Mail.AddAttachment (attach)
>
> Mail.Send
>
> End Function
>
> Then in the program I assign values to the variables email,subject and[/color]
body[color=blue]
> Next I call the function ...
> x = SendEmail(email, subject, body + Chr(13) + "Test", "c:\log.txt")
> on running it I get this err-message:
> User defined type not defined
> How do I solve this , Can anybody help me with that ?
> Any suggestions very much appreciated
>
> Ronny Sigo
>
>[/color]


Pink Panther
Guest
 
Posts: n/a
#3: Nov 12 '05

re: User defined type not defined


Hi Ronny,

Reply via google so someone else may have already responded...

I would say that you have no reference to the MailSender server thus
Access cannot create the object.

Goto Tools > References and reference the appropriate library. You
should be able to see the MailSender object in your object browser
once it referenced. Intellisense should also work with the object.

Alternatively check out the CreateObject and GetObject methods. This
will allow you to use late binding - ie you don't need to reference
the library.

Peter

"Ronny Sigo" <ronny.sigo@example.invalid> wrote in message news:<3fbf91e8$0$28306$ba620e4c@reader1.news.skyne t.be>...[color=blue]
> Hello all,
> I am trying to write a prog that autamatically sends emails ...
> Here is what I have done so far
> In the module section I have put this:
>
> Public Function SendEmail(email As String, subject As String, body As
> String, attach As String)
>
> Dim Mail As MailSender
> Set Mail = New MailSender
> Mail.Host = "relay.skynet.be"
> Mail.From = "my.emailaddress@myprovider.be"
> Mail.AddAddress (email)
> Mail.subject = subject
> Mail.body = body
> Mail.AddAttachment (attach)
>
> Mail.Send
>
> End Function
>
> Then in the program I assign values to the variables email,subject and body
> Next I call the function ...
> x = SendEmail(email, subject, body + Chr(13) + "Test", "c:\log.txt")
> on running it I get this err-message:
> User defined type not defined
> How do I solve this , Can anybody help me with that ?
> Any suggestions very much appreciated
>
> Ronny Sigo[/color]
Closed Thread