[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

system.net.mail MailMessage declaration problem, also how to attach files

Asked by idsnews in Programming for ASP.NET

every time I declare a new MailMessage the page won't load, not matter what I've tried, I get a runtime error at every point, and there doesn't seem to be alot of help online for the system.net.mail class

my code so far, I haven't had the chance to test it as even the declaration causes a runtime error

all I need is the easiest way to send text and some pictures from an online form, if there is an easier way to do this that'd bef fine

sending just text through Dim objMailer As New System.Net.Mail.SmtpClient() works just fine, it's MailMessage that has problems for some reason.

my code bellow

      Public Sub SendEmail(ByVal emailFrom As String, ByVal emailTo As String, ByVal emailSubject As String, ByVal emailBody As String)
          Dim objMailer As New System.Net.Mail.SmtpClient()
          Dim senMail As New System.Net.Mail.MailMessage()

          objMailer.Host = 'myrelayserv.com'      ' Your SMTP server
          objMailer.Send(emailFrom, emailTo, emailSubject, emailBody)
      End Sub

the rest of my code, right now it's all in comments as I can't get the mailmessage issue resolved, if you notice any problems in it please do let me know

      Sub Submit_Form(ByVal Sender As Object, ByVal E As EventArgs)
          'SendEmail(Me.email.Text, 'mail@school.edu', Me.name.Text, Me.ideas.Text)

          'create the mail message
          Dim senMail As New System.Net.Mail.MailMessage
         
          'set the addresses  
          senMail.From = New MailAddress(Me.email.Text)
          senMail.To.Add('mail@school.edu')

          'set the content
          senMail.Subject = Me.name.Text
          senMail.Body = Me.ideas.Text

          'add an attachment from the filesystem
          senMail.Attachments.Add(New Attachment(FileUpload1.PostedFile.FileName))

          ''to add additional attachments, simply call .Add(...) again
          ''mail.Attachments.Add(New Attachment('c:\temp\example2.txt'))
          ''mail.Attachments.Add(New Attachment('c:\temp\example3.txt'))

          ''send the message
          Dim smtp As New SmtpClient('myrelayserv.edu')
          smtp.Send(senMail)
         
      End Sub
[+][-]02/20/06 09:44 AM, ID: 16001850Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zone: Programming for ASP.NET
Sign Up Now!
Solution Provided By: imsolost
Participating Experts: 1
Solution Grade: B
 
[+][-]02/20/06 08:41 AM, ID: 16001323Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/06 08:55 AM, ID: 16001435Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/06 08:56 AM, ID: 16001450Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/06 09:00 AM, ID: 16001478Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/06 09:05 AM, ID: 16001513Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/06 09:07 AM, ID: 16001535Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/20/06 09:38 AM, ID: 16001789Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/06 09:40 AM, ID: 16001812Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/06 10:03 AM, ID: 16001992Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02/20/06 11:41 AM, ID: 16002856Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02/21/06 10:50 AM, ID: 16011357Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92