Click here to Skip to main content
15,892,839 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
Hi,
I am trying to send a mail on button click.But its give an error that is:

MSIL
The parameter 'address' cannot be an empty string.
Parameter name: address


mail.From = new MailAddress(txtemail.Text);in this line.
but if i use email id at the place of textbox in mail.From than its work.


please give me suggestion.




Thank You.
Posted
Updated 1-Oct-19 22:44pm
Comments
walterhevedeich 25-Jul-11 3:57am    
Judging from your description, your textbox might have an empty value.

From address is mandatory. If your txtemail.Text is empty, you will get this error. So, you should not allow the user to send the mail with out entering From address.
 
Share this answer
 
Hi,

Are you sure that txtemail.Text return the e-mail id typed by the user ?

Thanks,
Balaji
 
Share this answer
 
Comments
SURBHI TYAGI 25-Jul-11 3:57am    
ya...
Member 13411328 2-Nov-17 4:56am    
yes it is not showing the user typed email while debugging
please tell the solution
Check if the user entered any data?
 
Share this answer
 
As the error suggest , please check what you are receiving in txtemail.Text by debugging and make sure you pass something (i.e a valid email address) as it cannot be left blank.


hope it helps :)

for further queries comment here!!
 
Share this answer
 
Comments
SURBHI TYAGI 25-Jul-11 3:57am    
okss...
Member 7763245 13-Dec-12 5:58am    
I can not send email without filling the cc and bcc textbox. Please suggest me what is the problem? using asp.net c#.
Why in the world you want the user to enter 'From' email address in the txtemail.Text ?? He will use it for sending email from 'any email address' . He may send a abusive email to your girlfriend using your email id in the 'From' field..

The best way is to configure the 'From' address in config file.

And the reason behind this error is that the txtemail.Text is empty..You should enter a email address in it..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900