473,287 Members | 1,426 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,287 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 1329

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"
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.