Solved

SMTPsvg.Mailer error

Posted on 2004-09-06
15
1,698 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

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…
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/…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

636 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