Solved

SMTPsvg.Mailer error

Posted on 2004-09-06
15
1,693 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weighted Randomizing 6 38
Making Table Thru ASP Response.write 5 38
SP inserts data with order number, then push the rest one order up 11 44
SQL help please 15 37
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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

759 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