Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6829831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:32:47+00:00 2026-05-26T22:32:47+00:00

When I send mail from my Web page is both the from and to

  • 0

When I send mail from my Web page is both the from and to [personalemailremoved]@gmail.com when I received the email. What do I need to change to view from mail in gmail that the user filled in on the web site?

I Use Gmail to send email in my form and receive it via gmail:

Contact.cshtml

@using (Html.BeginForm("Contact", "Home", FormMethod.Post, new { id = "contactform" }))
    {

        <ol>
            <li>
                <label for="mail">
                    Din E-post*</label>
                @Html.TextBox("mail", null, new { @class = "text" })
            </li>
            <li>
                <label for="rubrik">
                    Rubrik*</label>
                @Html.TextBox("rubrik", null, new { @class = "text" })
            </li>
            <li>
                <label for="message">
                    Meddelande*</label>
                @Html.TextArea("meddelande")
            </li>
            <li class="buttons">
                <input type="submit" name="imageField" id="imageField" value="Skicka meddelande"
                    class="button" />
                <div class="clr">
                </div>
            </li>
        </ol>
    }

HomeController:

 public ActionResult Contact(string mail, string rubrik, string meddelande)
        {
            try
            {
                WebMail.SmtpServer = "smtp.gmail.com";
                WebMail.EnableSsl = true;
                WebMail.UserName = "personalemailremoved@gmail.com";
                WebMail.Password = "MYPASSWORD";
                WebMail.SmtpPort = 587;
                WebMail.Send(
                        "personalemailremoved@gmail.com",
                        rubrik,
                        meddelande,
                        mail
                    );

                return RedirectToAction("MailSent");
            }
            catch (Exception)
            {
                ViewData.ModelState.AddModelError("", "Kontrollera uppgifterna");
            }

            return View("Contact");
        }
        public ActionResult MailSent()
        {
            return View();
        }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:32:48+00:00Added an answer on May 26, 2026 at 10:32 pm

    Gmail actually changes this to the authenticated account automatically, so you need to use another server if you want to do that.

    If you don’t want to use a different SMTP server, don’t use any at all! When you connect to the mail server, don’t give it credentials. This is how SMTP servers send mail. It is important to note that this will only work if you are only sending an email to the user with a gmail.com email address. Otherwise it thinks you are using it as an open relay. You can have other addresses in the “To:” field, you just can’t add them when doing the SMTP communication. I actually did an independent study on this exact thing in college, I still have my code. You may actually need to do the SMTP communication by hand. If you need a quick guide to SMTP spec I can post a link to the handout I made that explains it (though it is less than official, it should be easier to read than the RFC).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to send e mail from a asp.net web site. I use this
import stdlib.web.mail from = {name=name address={local=username domain=gmail.com}} to = {name=name address={local=username domain=gmail.com}} r =
I wish to send an email from my localhost machine (using PHPs mail function)
here is the code. void sendMail() { MailMessage mail = new MailMessage(); mail.To.Add(abc@gmail.com); mail.From
Possible Duplicate: SMS from web application Sample code to send Mail via php //
Possible Duplicate: SMS from web application Sample code to send Mail via php //
I have the need from an asp.net web site to send out many SMS
I read from http://www.packtpub.com/article/friends-via-email-social-web-application-django-1.0 and follow the steps: => And change my setting.py SITE_HOST
In order to comply with HIPAA regulations, we need to send email from an
I have this problem in my web page, I need to send a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.