- Home /
Send an email C# error
OK here is my problem I copy a code that it was canceled as a question that is: http://answers.unity3d.com/questions/18952/system-net-mail-smtpclient-send-closed but my problem wasn't all that kind of things that he put like an error, actually its clear of does errors but I get an error that says
Assets/mail.cs(3,14): error CS0234: The type or namespace name
Windows' does not exist in the namespace
System'. Are you missing an assembly reference?
So maybe this is not the correct form to put it, but I try clearing that part but I get more errors about MessageBox.
Also and very important, I got another error that says
SocketException: No such host is known System.Net.Dns.GetHostByName (System.String hostName) System.Net.Sockets.TcpClient.Connect (System.String hostname, Int32 port) System.Net.Sockets.TcpClient..ctor (System.String hostname, Int32 port)
and the error is founded in Client.Send(Email);
So, Please answer, I need an answer of what is rong in this line of Client.Send(Email);.
Thanks... in advance.
Unfortunately, the Unity does not include every namespace in the Unity engine. I'm almost positive that System.Windows
is one of them not included. This is to save build size, but for some things like you mention it is a hindrance.
Answer by Fanboy · Feb 10, 2011 at 02:50 AM
usually this is because the DNS query returned two IP addresses (an ipv4 and an ipv6), the ipv6 was first in the list, and ipv6 is not enabled somewhere. You can solve it by manually resolving the host, and selecting the ipv4 address.
IPHostEntry hostInfo = Dns.GetHostByName(hostString);
foreach(IPAddress ip in hostInfo.AddressList)
{
if (ip.AddressFamily == ProtocolFamily.InterNetwork)
{
// this is the ipv4
}
}
sometimes that will give you more that one IP, make sure you check the result to get the one you wanted
Answer by boymeetsrobot · Dec 23, 2010 at 12:35 AM
Your question isn't entirely clear, but I think you may be trying to use Microsoft.NET namespaces. Monodevelop is an alternative IDE for multi-platform .net development and as such, you may have to use alternative namespaces in some instances. I suggest looking at the Monodevelop documentation to broaden your understanding: http://monodevelop.com/Documentation
Your answer
Follow this Question
Related Questions
How to fix Unity compiler error when building WP8.1 game? 2 Answers
Send Log file with email? ( IOException: Sharing violation on path) HELP 0 Answers
windows 8.1, won't export out to win8 1 Answer
SpeechRecognitionEngine.InstalledRecognizers() returns null within Unity. 3 Answers
Game not working after build 0 Answers