Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

E-mail Mail.CC

Posted on 2011-09-08
8
Medium Priority
?
345 Views
Last Modified: 2012-05-12
HI, when i try to run my application i get "the parameter 'addresses' cannot be an empty string" I am pulling supervisor name and e-mail from a SQL database that inserts into a checkbox list. when selected it creates a label.

here is the code i am working with.


  Mail.Subject = "An Incedent has Been Reported"
            Mail.To.Add("user.text.com")
            Mail.CC = New MailAddress (lblcbsuper.Text)
            Mail.From = New MailAddress("user@test.com")
            Mail.Body =
            Mail.IsBodyHtml = True

Dim smtp As New SmtpClient("mail.precisionaerogroup.com")

            smtp.Send(Mail)





        Catch ex As Exception
            MsgBox(ex.Message)

        End Try

        Response.Redirect("Submitted.aspx")
0
Comment
Question by:pai_01
  • 3
  • 3
  • 2
8 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 36503943
When you debug and step through does the error occur on the "Mail.CC = New MailAddress (lblcbsuper.Text)?"
0
 

Author Comment

by:pai_01
ID: 36504104
yes, it is also highlighted and says "Property 'CC' is read only
0
 
LVL 6

Accepted Solution

by:
Molly Fagan earned 1000 total points
ID: 36504274
Try using Mail.CC.Add(lblcbsuper.Text).  Unless you know you're always going to have a CC e-mail, I'd also do a check to make sure lblcbsuper.Text isn't an empty string before adding.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:pai_01
ID: 36504396
i tried that and it didn't work correctly. it said that it sent but it only sent to be and not to the CC from the checkbox list. also when i added the .add there is a red line under it that says

" Error      5      Overload resolution failed because no accessible 'Add' accepts this number of arguments.      c:\users\steveg\documents\visual studio 2010\Projects\Injury\Injury\Default.aspx.vb      152      13"
0
 
LVL 15

Assisted Solution

by:David L. Hansen
David L. Hansen earned 1000 total points
ID: 36505125
Do you have to use the CC, because you are allowed to add more than one person in the "To"

example:
Mail.To.Add("user.text.com")
Mail.To.Add(lblcbsuper.Text)
0
 

Author Comment

by:pai_01
ID: 36505180
that seemed to work. but instead of the lblcsuper. i used the slected value from the check box. thank you for all the help though and great ideas.
0
 
LVL 6

Expert Comment

by:Molly Fagan
ID: 36505237
Are you using System.Net.Mail?  If you are, is "Mail" in your code of type MailMessage?  An example from some code I have:

Dim oMsg = New MailMessage("fromaddress@email.com", "toaddress@email.com")

And then if I need to CC, I add those addresses in.
0
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 36505982
Glad to help.  Try mjfagan's suggestion, if it works we can split the points perhaps.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Integration Management Part 2
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

885 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