Thread: Smtp???

  1. #1
    Registered User
    Join Date
    Sep 2001
    Posts
    173

    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!
    Don't laugh at me,I am just a SuperNewbie.

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    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
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Actually I've tried those sites and solutions, but none of them worked, I'll find the answer anyway.
    thank you
    Don't laugh at me,I am just a SuperNewbie.

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Just taking wild guesses but... do you have an Smpt-Server installed on your PC ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    No, it is just a normal PC
    Don't laugh at me,I am just a SuperNewbie.

  6. #6
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    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 ?

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    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
    Don't laugh at me,I am just a SuperNewbie.

  8. #8
    Something Clever ginoitalo's Avatar
    Join Date
    Dec 2001
    Posts
    187
    Also, make sure your using all the necessary namespaces.


    Post some code once you get it running

  9. #9
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    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
    Don't laugh at me,I am just a SuperNewbie.

  10. #10
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    Yes,I made it,
    I have installed IIS and Microsoft SMTP service, now It works great , thank you!!!
    Don't laugh at me,I am just a SuperNewbie.

  11. #11
    Mail-Man
    Guest
    I'm trying to do something with mailing, can you post some sample code ?

  12. #12
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    Codeproject has nice samples:

    http://www.codeproject.com/csharp/#Internet
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  13. #13
    Registered User
    Join Date
    Sep 2001
    Posts
    173
    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.
    Don't laugh at me,I am just a SuperNewbie.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SMTP with Apache/PHP on Windows
    By Mario F. in forum Tech Board
    Replies: 4
    Last Post: 02-29-2008, 09:24 AM
  2. SMTP host???
    By Yarin in forum Tech Board
    Replies: 6
    Last Post: 01-03-2008, 12:29 PM
  3. gmail SMTP
    By Scarvenger in forum Tech Board
    Replies: 6
    Last Post: 01-05-2007, 08:39 PM
  4. SMTP Server Not Working
    By (TNT) in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-15-2003, 05:33 AM
  5. Win2k pro SMTP
    By _mails_ in forum Tech Board
    Replies: 1
    Last Post: 12-11-2002, 09:33 PM