PDA

Click to See Complete Forum and Search --> : [1.0/1.1] can not send email to hotmail


contactumair
Nov 9th, 2006, 04:06 AM
I am unable to send email to hotmail but i am able to send mail to all other mailing address.please solve my problem.I dont get any error its just i canot recieve email in hotmail.this is my code


MailMessage objMailMessage=new MailMessage();

objMailMessage.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",1 );
objMailMessage.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendusername","test@mycompany.com" );
objMailMessage.Fields.Add( "http://schemas.microsoft.com/cdo/configuration/sendpassword","password" );

objMailMessage.To=txtFriendsEmail.Text;
objMailMessage.From="info@mycompany.com";
objMailMessage.Subject="subject"
MailMessage.BodyFormat=MailFormat.Html;
objMailMessage.Body="here is my message body"
SmtpMail.SmtpServer="localhost";
SmtpMail.Send(objMailMessage);

Fishcake
Nov 10th, 2006, 06:37 AM
No help I'm afraid but just letting you know I've had exactly the same problem. Have you checked hotmail's spam folder?

contactumair
Nov 10th, 2006, 07:10 AM
Yes i have checked the spam but no mail.

Fishcake
Nov 10th, 2006, 08:10 AM
I can only presume hotmail doesn't like the domain the mail is coming from. When this happened to me mail was recieved my googlemail, yahoo mail etc just not hotmail.

When i moved to the deployment server though everyone was ok.

Harsh Gupta
Nov 10th, 2006, 08:37 AM
If you put the Send() in the Try block, check for the exception message. It should be something like "Could not access CDO.Message object". It happens usually if you use Localhost as your host.

You would have to add the Microsoft CDO for Windows 2000 Library reference. Check post number 7 in this thread - MSDN Forums (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=717&SiteID=1).

EDIT: Forgot to add, this problem is quite persistent in VS 2003, and I have never succeeded in sending mail to myself (regardless of hotmail) using the same method you have posted.

Also check this link - www.systemwebmail.com (http://www.systemwebmail.com/default.aspx)

contactumair
Nov 10th, 2006, 10:02 AM
but this wont work on all the windows.if the server doesnot have windows2000 then this solution wont work

ekim12987
Nov 14th, 2006, 07:35 AM
I had the same problem. I cant remember the exact error, but it was something to the effect of a relay, which hotmail blocks because of spam.

tr333
Dec 12th, 2006, 06:31 AM
i've had this problem before, and i managed to solve it by adding in some specific e-mail headers.
E-mail sent without these headers was being sent straight to my hotmail spam box.

here is some sample code (mail server and e-mail addresses modified) that i used to send an email to hotmail using mono/.net 1.1:

using System;
using System.Web.Mail;

public class test
{
public static void Main()
{
try
{
MailMessage msg = new MailMessage();
msg.To = "someone <someone@example.com>";
msg.From = "test <test@example.com>";
msg.Subject = "test email";
msg.Body = "test email";
msg.Headers.Add("Reply-To", "reply-to-address");
msg.Headers.Add("MIME-Version", "1.0");
msg.Headers.Add("X-Priority", "3 (Normal)");
msg.Headers.Add("Content-Type", "text/plain;charset=iso-8859-1");
msg.Headers.Add("Content=Transfer-Encoding", "8bit");
SmtpMail.SmtpServer = "mail.server";
SmtpMail.Send(msg);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}

(the PHP tags are just for code formatting... it's still C# code)