Solved

SMTPsvg.Mailer error

Posted on 2004-09-06
15
1,677 Views
Last Modified: 2007-12-19
I get the following error when I try to CC or BCC other emaila addresses:

Object doesn't support this property or method: 'AddAddress'

Here's my code.  Any ideas?

...

'*******************************************
        ' EMAILING CODE
        '*******************************************
            strHost = "localhost"
            Set Mailer = Server.CreateObject("SMTPsvg.Mailer")
        Mailer.RemoteHost = strHost
        Mailer.FromAddress = Request("name")
        Mailer.AddAddress "matt@yahoo.com"
        Mailer.AddBCC "matt2@yahoo.com"
        Mailer.Subject = "Press Inquiry"

...

I think the problem lies somewhere in there...
0
Comment
Question by:mattybrigh
  • 6
  • 5
  • 3
  • +1
15 Comments
 
LVL 3

Expert Comment

by:Ayesha_K
ID: 11990394
Hi ...

i always use .To, .From, .CC and .BCC attributes ....

why are you using FromAddress, AddAddress and AddBCC .... i hope i'm not missing out some obvious thing ...

0
 

Author Comment

by:mattybrigh
ID: 11990618
This is what I have...verbatim.


<%
        '*******************************************
        ' EMAILING CODE
        '*******************************************
             
 
      ' change to address of your own SMTP server
      strHost = "localhost"

      If Request("Send") <> "" Then
            
            Set Mail = Server.CreateObject("SMTPsvg.Mailer")
            ' enter valid SMTP host
            Mail.RemoteHost = strHost

            Mail.FromAddress = Request("name") ' From address
            Mail.CC = "matt@dvdauthority.com"
            Mail.BCC = "foulmouthedleon@yahoo.com"  <-----I've also tried      Mail.Addrecipient request ("To")

            ' message subject
            Mail.Subject = "dvd/authority press inquiry"
            ' message body
            Mail.BodyText = Request("name")
            Mail.BodyText = Request("org")
            Mail.BodyText = Request("title")
            Mail.BodyText = Request("email")
            Mail.BodyText = Request("comments")

            strErr = ""
            bSuccess = False
            On Error Resume Next       
            If Mail.SendMail Then  
                  bSuccess = True
            else
                  strErr = Mail.Response
            End If
      End If
%>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11990626
Please see this:

http://www.netline.ch/support/info/aspcomp/aspmail3.html

and go to the portion about CC and BCC. In particular:

"AddCC or AddBCC doesn't work" - is this a bug with AspMail?

AddRecipient, AddCC and AddBCC work just as they should. The problem is not with AspMail. It is likely that your SMTP server is rejecting "foreign addresses" (see "no relay" question below).
To test whether AspMail is functioning properly use the SMTPLog property to capture an SMTP session with multiple recipients. All the recipients you send to should appear in the log as the SMTP envelope is sent. If they all appear then the problem is with your SMTP server or an SMTP server down the stream (or your addresses are invalid).

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11990634
From the same link:

What's the syntax for adding multiple recipients?

Mailer.AddRecipient "name1", "address1"
Mailer.AddRecipient "name2", "address2"
Mailer.AddBCC "name3", "address3"


FtB
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 500 total points
ID: 11990699
So,  it should be:

<%
        '*******************************************
        ' EMAILING CODE
        '*******************************************
           
 
     ' change to address of your own SMTP server
     strHost = "localhost"

     If Request("Send") <> "" Then
         
          Set Mail = Server.CreateObject("SMTPsvg.Mailer")
          ' enter valid SMTP host
          Mail.RemoteHost = strHost

          Mail.FromAddress = Request("name") ' From address
          Mail.CC = "matt@dvdauthority.com"
          Mail.AddBCC "foulmouthedleon@yahoo.com"
          ' message subject
          Mail.Subject = "dvd/authority press inquiry"
          ' message body
          Mail.BodyText = Request("name")
          Mail.BodyText = Request("org")
          Mail.BodyText = Request("title")
          Mail.BodyText = Request("email")
          Mail.BodyText = Request("comments")

          strErr = ""
          bSuccess = False
          On Error Resume Next      
          If Mail.SendMail Then  
               bSuccess = True
          else
               strErr = Mail.Response
          End If
     End If
%>
0
 

Author Comment

by:mattybrigh
ID: 11990703
Ok...should this work and if not, what do I need to change?

<%
        '*******************************************
        ' EMAILING CODE
        '*******************************************
             
 
      ' change to address of your own SMTP server
      strHost = "localhost"

      If Request("Send") <> "" Then
            
            Set Mail = Server.CreateObject("SMTPsvg.Mailer")
            ' enter valid SMTP host
            Mail.RemoteHost = strHost

            Mail.FromName = Request("name")
            Mail.AddRecipient "Matt Brighton", "matt@dvdauthority.com"
            Mail.AddRecipient "Matt Brighton", "foulmouthedleon@yahoo.com"

 

            ' message subject
            Mail.Subject = "dvd/authority press inquiry"
            ' message body
            Mail.BodyText = Request("name")
            Mail.BodyText = Request("org")
            Mail.BodyText = Request("title")
            Mail.BodyText = Request("email")
            Mail.BodyText = Request("comments")

            strErr = ""
            bSuccess = False
            On Error Resume Next       
            If Mail.SendMail Then  
                  bSuccess = True
            else
                  strErr = Mail.Response
            End If
      End If
%>
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11990724
That looks good....

FtB
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:mattybrigh
ID: 11990744
It doesn't send the email, but it doesn't give me an error either.  I don't get it...
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11990757
Just for testing, what happens if you try with just one address, i.e.:

        Mail.FromName = Request("name")
          Mail.AddRecipient "Matt Brighton", "matt@dvdauthority.com"
          ' message subject
          Mail.Subject = "dvd/authority press inquiry"
0
 

Author Comment

by:mattybrigh
ID: 11990856
Looks like the same thing.  It doesn't give an error and inserts into the db (I didn't post that part b/c it works), but no mail...
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 11990880
Okay, it may be time to try the code in isolation--perhaps you could create a test page with just the bare bones code for sending mail and then test that?

FtB
0
 
LVL 15

Expert Comment

by:Thogek
ID: 11993594
See http://www.serverobjects.com/comp/Aspmail4.htm for full SMTPsvg.Mailer documentation.
0
 
LVL 15

Expert Comment

by:Thogek
ID: 11993597
In your last full-code post above, do you also Response.Write strErr to see if it contains anything?
0
 

Author Comment

by:mattybrigh
ID: 11993602
No.  Where would I put that in the code above?
0
 
LVL 15

Expert Comment

by:Thogek
ID: 11993604
It's not very helpful populating strErr if you never look at the value you got, is it?

How about:

          If Mail.SendMail Then  
               bSuccess = True
          else
               strErr = Mail.Response
               Response.Write "Error: " & strErr & "<br />"
          End If
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now