Can't send mail?

B

brett

I'm getting this error when I try to send mail from my local machine:

The "SendUsing" configuration value is invalid.

Exception Details: System.Runtime.InteropServices.COMException: The
"SendUsing" configuration value is invalid

Here is the code I'm using:

string emailTo = "(e-mail address removed)";
string emailFrom = "(e-mail address removed)";
string emailSubject = "Message Inquiry";
string emailBody = "body here";
System.Web.Mail.SmtpMail.Send(emailFrom, emailTo, emailSubject,
emailBody);

When I upload this to the web server, I don't get an error but I don't
get mail either. Any suggestions?

Thanks,
Brett
 
A

Aaron

Brett,

What language?

IF vb; where are your dim statements and
<%@ Import Namespace="System.Net.Mail" %>

Aaron
 
B

brett

I thought by the syntax it was implied this is C#. Here are the using
statements:

using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.Mail;

What else do you need to see?

Thanks,
Brett
 
G

Guest

The 2003 method for sending SMTP mail is obsolete, I think the compiler
should give you a warning on that. You should now use the System.Net.Mail
rather then the System.Web.Mail. I can not say if this is the problem, as
the compile is a warning and not an error, but regardless, you should
probably convert you code to use the new namespace and methods.
 
B

brett

I was originally using that code. It doesn't work either. This
started about 5 days ago. I've made code changes since and not sure
what triggered it. I can't rule out something may be wrong with the
mail server. I've sent my hosting service an email asking but haven't
heard back.

Thanks,
Brett
 
A

Aaron

Brett,

try this

//------------code starts-------------------
System.Web.Mail.MailMessage mail = new System.Web.Mail.MailMessage();
mail.To = "(e-mail address removed)";
mail.From = "(e-mail address removed)";
mail.Subject = "this is a test email.";
mail.Body = "this is my test email body";
System.Web.Mail.SmtpMail.SmtpServer = "whatever your smtp server name is";
System.Web.Mail.SmtpMail.Send(mail);
//-----------end code----------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,067
Latest member
HunterTere

Latest Threads

Top