Results 1 to 7 of 7

Thread: Sending Email without using SMTPServer details

  1. #1

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117

    Sending Email without using SMTPServer details

    Hi all,
    I need to send a mail from my web page. I got the sample to send the mail using system.web.mail class and thus by creating an object of mailmessgae(). But there I have to give the value for SmtpMail.SmtpServer. I'm not sure about the clients SMTP server details.
    Is there any other way to send mail without giving the value of SmtpMail.SmtpServer?.
    I think this was possible with ASP's CDONTS. Is there any equivalent code in ASP.NET?

    PLease help
    when in doubt, win the trick

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    If your sending the mail from your page, you use your smtp server.

    So, if your page is www.something.com you will probably use mail.something.com as the smtp server (you will have to check with your hosting company for the exact one). All you are doing is setting how your asp.net app is going to send the mail. It has nothing to do with the client.

  3. #3

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    yes. I meant the hosting company not the client

    But In classic ASP, that can be done without giving those address. right?.
    And that means In case if I'm doing a site for a third party who is not decided where and when to host yet, what would I do?.
    Should I 've change the code then?

    Thanks Mr.hellswraith for your response.
    when in doubt, win the trick

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Take a look at this thread:
    http://www.vbforums.com/showthread.p...hreadid=246409

    It gives a way to store the connection string in the web.config file. You can do the same for the smtp server. Since the web.config file is just an xml file, the end user can open it up, add in their smtp server, and they are done.

    You just need to give them instructions on how to perform this (open the file in notepad, find the smtp server element, change to their smtpserver).

    Also, with traditional ASP, you relied on 3rd party components to send mail. They also require a smtp server. If you host had these components installed, then they configured them for your use already, that is why you never had to deal with it.

  5. #5

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    Thanks again Mr.Hellswraith.
    Nice solution. Thanks.

    ... and in traditional ASP I just used the CDONTS object. The code sequence was as follows..

    Set objMsg = Server.CreateObject("CDONTS.NewMail")
    objMsg.BodyFormat = 0
    objMsg.MailFormat = 0
    objMsg.From = "[email protected]"
    objMsg.To = "[email protected]"
    objMsg.Subject = "Greeting"
    objMsg.Body = "Hi"
    objMsg.Send
    Set objMsg = Nothing

    any suggestions?
    when in doubt, win the trick

  6. #6
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You may have, but I used something like jmail or something. So, this would pose a problem when you tried to distribute your code, because you didn't know what object the person had on their server. If I released code for jmail, and sent it to you, you wouldn't be able to use it unless you also had jmail, or you would have to re write the code to make it work with your CDONTS object.

    Now with the .Net framework, we don't have to worry. The only thing that needs to be configured is the smtp server.

    Good luck.

  7. #7

    Thread Starter
    Lively Member afterMoon's Avatar
    Join Date
    Oct 2002
    Location
    cochin
    Posts
    117
    Okey Mr.Hellswraith, I have to it in .NET anyway.

    Thanks for your patience
    when in doubt, win the trick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width