Solved

SMTPsvg.Mailer error

Posted on 2004-09-06
15
1,684 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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/…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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