Solved

SMTPsvg.Mailer error

Posted on 2004-09-06
15
1,676 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now