-
Smtp???
hi:
I just want to create such mail system to send mail in C#:
here is the code:
MailMessage mail = new MailMessage();
mail.From = "[email protected]";
mail.To = "[email protected]";
mail.Subject = "Test Message";
mail.Body = "Test Message";
mail.BodyFormat = MailFormat.Text;
SmtpMail.Send(mail);
and it crashed with such message:
Cound not access 'CDO.Messgae' object.
I have the outlook, what is the problem?
thank you!
-
Do you know what is meant by the CDO.Message object ?
Various answers I found on the net by searching Google:
"About could not access CDO.Message object.. This is because your SMTP server does not allow routing by itself.. You have to go into the SMTP properties, change the Relay permissions to allow it to relay from 127.0.0.1 (or localhost). This will allow itself to relay out messages. "
OR
"Try adding ... SmtpMail.SmtpServer = "localhost" ... as noted here: http://www.orcsweb.com/articles/emailasp.asp"
Check this for a nice example:
http://www.c-sharpcorner.com/Internet/MailingAppMG.asp
-
Actually I've tried those sites and solutions, but none of them worked, I'll find the answer anyway.
thank you :)
-
Just taking wild guesses but... do you have an Smpt-Server installed on your PC ?
-
No, it is just a normal PC :(
-
To add to nvoigt's reply,
I think you should try to install IIS, it's on the Windows CD,
it's an optional feature (for win2k pro anyways)
Also note your spelling:
>> Cound not access 'CDO.Messgae' object.
Message is spelled incorrect, did you code this or just mistype it on the thread ?
-
I mistyped this, it should be
could not access CDO.Message object, it came from the exception handler,I'll try the way you told me, thank you very much
-
Also, make sure your using all the necessary namespaces.
Post some code once you get it running :cool:
-
Ok, it didn't work even after I installed IIS, I got the same errror message, so I checked the website,somehow they said that "Microsoft SMTP service" also needed to be installed, so how can I do with that?
thanks
-
Yes,I made it,
I have installed IIS and Microsoft SMTP service, now It works great :), thank you!!!
-
I'm trying to do something with mailing, can you post some sample code ?
-
-
here is the code:
private button1_click(..........)
{
MailMessage mailMsg = new MailMessage();
mailMsg.From = txtFrom.Text; // source email address
mailMsg.To = "[email protected]"; // destination email address
mailMsg.Cc = txtCC.Text;
mailMsg.Bcc = txtBCC.Text;
mailMsg.Subject = txtSub.Text;
mailMsg.Body = txtBody.Text;
if(txtBody.Text==""||txtSub.Text=="")
MessageBox.Show("Wrong Input","Error",
MessageBoxButtons.OK,MessageBoxIcon.Information);
else
{
SmtpMail.Send(mailMsg);
MessageBox.Show("message has been sent");
}
}
Create the the corresponding text boxes with the names above, before run it, install the IIS from Win2k CD the add-on option and
"Microsoft SMTP service" I found from the internet, but forgot the link. These are all what I have done, good luck.