473,378 Members | 1,680 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

problem using SmtpClient to send email from asp.net

Jay
The code below is a recommended way to send email with c# from my aspx page:
MailMessage mail = new MailMessage();
mail.From = new MailAddress("de*********@ziptax.com");
mail.To.Add(new MailAddress(strTo));
mail.Subject = "ZipTax Survey Received";
mail.Body = body;
SmtpClient client = new
SmtpClient(System.Configuration.ConfigurationManag er.AppSettings["SmtpServer"]);
try
{
client.Send(mail);
}
catch (Exception ex)
{
Response.Write(ex);
}

My from, to, subject and body are all populated and not null. But I get the
error below when run from my asp.net host provider:

ERROR: System.ArgumentNullException: Value cannot be null. Parameter name:
value at System.Net.Mail.SmtpClient.set_Host(String value) at
ZipTaxSurvey.Button1_Click(Object sender, EventArgs e)

Can someone please advise?
Thanks,
jay
Mar 18 '06 #1
0 1332

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: HoustonComputerGuy | last post by:
I am working on getting my web applications moved to .Net 2.0 and am having some problems with System.Net.Mail. I get the following error when sending the mail: System.Net.Mail.SmtpException was...
3
by: Opa | last post by:
Hi, I'm trying to send mail from my ASP.NET application using the new System.Net.Mail classes. The code is fairly basic string SMTPServer = "smtp.atlanticbb.net"; SmtpClient client = new...
6
by: AbraAbraCadabra | last post by:
Ok I think I've almost got my problem solved. I am using this code to send mail. I am simply pasting it into an .ASP page. Why doesn't this code work? I do have ..NET 2.0 installed, but I...
2
by: shapper | last post by:
Hello, I have a contact form in my web site which is working just fine on my computer! When I uploaded my web site to my hosting server I get an error when I SUBMIT my form, i.e., when I...
4
by: Ron | last post by:
I have this code on one of my forms, the code takes whatever is in textboxes and adds it to a MS Access Database. It then shows a message that the operation was completed. Is there a universal...
2
by: =?Utf-8?B?Q2FwdGFpbiBEYXZlIQ==?= | last post by:
I wrote some code to send an email with two alternate views: 1) html 2) plain text All the html enabled email clients accept the html just fine and disregard the plain text version. However,...
3
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
I have the following code to send an email and I get this error: . The error is on at last line below. SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); ...
11
by: Ed Bitzer | last post by:
I have been able using the namespace System.Web.Mail and its method Smtp.mail.send to mail simple text messages to a small group within our 55 and older community. I need help expanding the...
5
by: BigDave | last post by:
Hi, I'm having problems with SmtpClient. I have the following set in my web.config: <configuration> <system.net> <mailSettings> <smtp> <network host="mysmtp" port="25" userName="myuser"
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.