convert coldfussion code to asp.net (vb or c#) also to asp

Last post 07-29-2009 5:19 AM by susain. 2 replies.

Sort Posts:

  • convert coldfussion code to asp.net (vb or c#) also to asp

    07-27-2009, 5:57 AM
    • Contributor
      2,324 point Contributor
    • susain
    • Member since 10-29-2007, 7:51 AM
    • Hyderabad, Andhra Pradesh, India
    • Posts 646

    Hi Friends,

    Can you please convert this coldfussion code to vb or c#.net also to asp

    <cfparam name="destinationemail" default="test@test.com">
    <cfparam name="emailheader" default="Contact Form">
    <CFMAIL SERVER="info:test@test.com"
      FROM="#email#"
              TO="#destinationemail#"
              Subject="#emailheader#"
        type="HTML">

       <b>Name:</b> #name# <br>
       <b>Email:</b> #email# <br>
       <b>Phone:</b> #phone#<br>
       <b>Questions / Comments:</b> #comments#<br>

     </CFMAIL>

      <cflocation url="http://www.xyz.com">

    Thanks,

    Mohammed Farooq

    Linked In: http://www.linkedin.com/in/mohammedfarooq123

    Mark as answer if this post help full to you.
  • Re: convert coldfussion code to asp.net (vb or c#) also to asp

    07-27-2009, 11:55 AM
    Answer
    • Contributor
      5,138 point Contributor
    • papabear
    • Member since 08-08-2005, 3:49 PM
    • Posts 851

    What you want to use is the System.Net.Mail namespace (NOT System.Web.Mail)

    I am assuming that you are getting your variables from Textboxes? I won't go into checking them (you never want to trust user-entered data), just assume that they are fine for this example:

    string _destinationEmail = "test@test.com";
    string _subject = "Contact Form";

    MailMessage _message = new MailMessage(EmailTextBox.Text, _destinationEmail);
    _message.Subject = _subject;
    _message.Body = String.Format("<b>Name</b>{0}<br/><b>Email</b>{1}<br/><b>Phone</b>{2}<br/><b>Questions</b>{3}<br/>",
         NameTextBox.Text, EmailTextBox.Text, PhoneTextBox.Text, CommentsTextBox.Text);
    _message.IsBodyHmtl = true;
    SmtpClient _mailClient = new SmtpClient("myMailServer.myDomain.com");
    _mailClient.Send(_message);

    Response.Redirect(@"http://www.xyz.com", true);

    Hope this helps,

    m

    give me suggestions for what to blog... http://www.myfriedmind.com/techblog -> thx

    Mark as "Answered" if this solves that wee old problem...
  • Re: convert coldfussion code to asp.net (vb or c#) also to asp

    07-29-2009, 5:19 AM
    Answer
    • Contributor
      2,324 point Contributor
    • susain
    • Member since 10-29-2007, 7:51 AM
    • Hyderabad, Andhra Pradesh, India
    • Posts 646

    Thanks for the reply!!

    I know how to send mail in asp.net, I did many times but wanted to see the code in asp.

    I solved the problem with http://www.w3schools.com/asp/asp_send_email.asp for asp code.

     

    Thanks,

    Farooq

    Linked In: http://www.linkedin.com/in/mohammedfarooq123

    Mark as answer if this post help full to you.
Page 1 of 1 (3 items)