Forum Moderators: open

Message Too Old, No Replies

ASP Email Type Mismatch Error

         

flashnv

7:07 pm on Dec 4, 2003 (gmt 0)

10+ Year Member



I am using Persits to send email newsletters to all ids in a database.

The main code is:

While Not rs.EOF
Set sub_email = rs("email")
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "mysite.com" ' Required
Mail.Port = 25 ' Optional.
Mail.FromName = "Newsletter from mysite.com"
Mail.From = "send@mysite.com"
Mail.AddAddress sub_email
Mail.UserName="send@mysite.com"
Mail.Password="cards"
Mail.Subject = my_subject
Mail.Body = my_message & rs("email")
On Error Resume Next
Mail.Send

But I get the following Type Mismatch error:
Type mismatch: 'AddAddress'

What am I doing wrong here?

defanjos

10:51 pm on Dec 4, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Mail.AddAddress sub_email

should be:
Mail.AddAddress = sub_email

BTW, welcome to WebmasterWorld

flashnv

2:59 am on Dec 5, 2003 (gmt 0)

10+ Year Member



Hi Defanjos,

Thanks for your suggestion. I tried that but get adifferent error on using '=':
Object doesn't support this property or method: 'AddAddress'

Any other ideas? Thanks nevertheless...

defanjos

3:25 am on Dec 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, my mistake.

It should not have the "=" sign.

Try this:
Mail.AddAddress sub_email, "John Smith"

John Smith, obviously, can be any name.

It might even work like:
Mail.AddAddress sub_email, ""

Addition:
I think the problem could be here:

Set sub_email = rs("email")

Why don't you do:

dim sub_email
sub_email = rs("email")

flashnv

5:23 am on Dec 5, 2003 (gmt 0)

10+ Year Member



Hi there!

Tried both your suggestions. It still doesn't work. Gives the same Type Mismatch error...

defanjos

6:20 am on Dec 5, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you have any empty or invalid email addresses on the "email" field of the db? That could be the problem.

flashnv

6:47 am on Dec 5, 2003 (gmt 0)

10+ Year Member



Hi,

Thanks so much, that's what the problem was - empty email addresses. Thanks a ton! Really appreciate it...