Sending e-mail messages using C# How to send e-mail messages using C# and WinForms.
#16 Guest_turqoil*
Posted 28 April 2010 - 05:58 PM
I got failure sending mail. The server is smtp.mail.yahoo.com.sg and port is 587. What is the problem?
#17 Guest_Ed*
Posted 06 January 2011 - 06:37 AM
fyi guys, if you want to send email using hotmail you have to use the following code:
Note the two key lines: port number is set to 587 and enablessl is set because hotmail uses SecureSocketsLayer on its connections. The email that is sent says :
From: [the server email account adress] on behalf of [name of person account is registered to] ([the email address you put as from i.e. a@bb.net])
This means you cannot create fake emails through Hotmail without the receiver knowing
Hope this helps, Ed
SmtpClient client = new SmtpClient("smtp.live.com");
MailMessage message = new MailMessage("a@bb.net", "lukyperson@somewhere.com");
message.Body = "Some text";
message.Subject = "A subject";
client.Credentials = new System.Net.NetworkCredential(Username, Password);
/*---->*/ client.Port = 587;
/*---->*/ client.EnableSsl = true;
client.Send(message);
Note the two key lines: port number is set to 587 and enablessl is set because hotmail uses SecureSocketsLayer on its connections. The email that is sent says :
From: [the server email account adress] on behalf of [name of person account is registered to] ([the email address you put as from i.e. a@bb.net])
This means you cannot create fake emails through Hotmail without the receiver knowing
Hope this helps, Ed
This post has been edited by JackOfAllTrades: 07 January 2011 - 06:40 AM
#18
Posted 18 March 2011 - 07:14 AM
If I get the error: Input string was not in a correct format.
How I can solve it?
Thanks for help.
How I can solve it?
Thanks for help.
#19
Posted 18 March 2011 - 07:37 AM
#20
#21
Posted 01 April 2011 - 03:35 AM
I am creating window application
when I am sending mail at that time error occur
Cannot sent Message : Failure sending mail.
can you tell me what is the problem in my code.
when I am sending mail at that time error occur
Cannot sent Message : Failure sending mail.
can you tell me what is the problem in my code.
try
{
MailMessage mail = new MailMessage(txtfrom.Text, txtto.Text);
mail.From = new MailAddress(txtfrom.Text);
mail.To.Add(txtto.Text);
mail.Subject = txtsubject.Text;
mail.Body = txtmess.Text;
SmtpClient smtp = new SmtpClient();
smtp.Host = "mail.mycompanyid.net";
smtp.Port = 25;
NetworkCredential NetCrd = new NetworkCredential();
NetCrd.Domain = "ip";
NetCrd.UserName = "myid";
NetCrd.Password = "mypass";
smtp.UseDefaultCredentials = false;
smtp.Credentials = NetCrd;
smtp.EnableSsl = true;
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(mail);
MessageBox.Show("Your Message Sent Successfully");
}
catch (Exception ee)
{
MessageBox.Show("Cannot send message: " + ee.Message);
}
#22
Posted 02 June 2011 - 12:20 AM
me too. i can't send email. please contact to me.
*******REMOVED EMAIL ADDRESS******* thanks please please
The parameter 'from' cannot be an empty string.
Parameter name: from
MailMessage message = new MailMessage(sendFrom.Text, sendTo.Text);
*******REMOVED EMAIL ADDRESS******* thanks please please
The parameter 'from' cannot be an empty string.
Parameter name: from
MailMessage message = new MailMessage(sendFrom.Text, sendTo.Text);
#23
Posted 07 June 2011 - 01:05 PM
minhkhanh62, on 02 June 2011 - 03:20 AM, said:
me too. i can't send email. please contact to me.
*******REMOVED EMAIL ADDRESS******* thanks please please
The parameter 'from' cannot be an empty string.
Parameter name: from
MailMessage message = new MailMessage(sendFrom.Text, sendTo.Text);
*******REMOVED EMAIL ADDRESS******* thanks please please
The parameter 'from' cannot be an empty string.
Parameter name: from
MailMessage message = new MailMessage(sendFrom.Text, sendTo.Text);
I think that error message is pretty self-explanatory. The From parameter(the first parameter) can't be blank.
#25
Posted 23 June 2011 - 07:20 PM
I somehow set my email Username, Password, Host and Port in web.config file.
When sending email, it actually send from the email I set.
Is it possible to not displaying my email but display "noreply@mydomain.com" to receiver?
When sending email, it actually send from the email I set.
Is it possible to not displaying my email but display "noreply@mydomain.com" to receiver?
#26
Posted 23 June 2011 - 07:38 PM
#27
#28
Posted 25 June 2011 - 06:20 AM
#29
Posted 29 October 2011 - 03:45 AM
to the author..
what to write in send server,server port?how can i find that from my computer?
what to write in send from? user and password?which user id ??
what to write in send server,server port?how can i find that from my computer?
what to write in send from? user and password?which user id ??
#30
Posted 06 January 2012 - 06:13 AM
Please i need some clarification on this.I really don't understand this part smtp.Host = "mail.mycompanyid.net";.What is this really talking about is it looking for my machine name or which ESSEL-PC or localhost or is it for example i have an email at yahoo so in that case can i just write smtp.yahoo.com or.Please help me
|
|

MultiQuote








|