locked
Web Matrix SMTP Service RRS feed

  • Question

  • User1075652024 posted

    Yahoo doesn't accept email from web app where as hotmail, gmail is accepting mail from web app; using following setting for message relay through gmail

    WebMail.SmtpServer="smtp.gmail.com";  

    WebMail.SmtpPort =587;

    WebMail.EnableSsl=true;  

    WebMail.UserName="<a valid gmail account>";

    WebMail.From="<the same valid gmail account";  

    WebMail.Password="<the correct password";

    So far many other applications using the same setting are relaying message to yahoo but not webmatrix applications.

    I shall be grateful for the advice.

    Monday, March 2, 2015 4:49 AM

Answers

  • User1713851783 posted

    I have made some tests and this page sends messages without problems:

    @{
        WebMail.SmtpServer = "smtp.mail.yahoo.com";
        WebMail.SmtpPort = 587;
        WebMail.EnableSsl = true;
        WebMail.UserName = "your_address";
        WebMail.Password = "your_password";
        WebMail.From = "your_address";
    
        if(IsPost)
        {
            var email = Request["Email"];
            var mailsub = Request["Subject"];
            var mailtxt = Request["Body"];
            WebMail.Send(
                to: email,
                subject: mailsub,
                body: mailtxt
            );
        }
    }
    
    <!DOCTYPE html>
    <html>
    <head>
      <title>Send Email</title>
    </head>
    <body>
        <div>
            <form method="post">
                <p>
                    <label for="Email">To: </label>
                    @Html.TextBox("Email") 
                </p>
                <p>
                    <label for="Object">Subject: </label>
                    @Html.TextBox("Object") 
                </p>
                <p>
                    <label for="Text">Body: </label>
                </p>
                <p>
                    @Html.TextArea("Body")
                </p>
                <p>
                    <input type="submit" value="Send" />
                </p>
            </form>
        </div>
    </body>
    </html>
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 2, 2015 7:19 PM

All replies

  • User753101303 posted

    Hi,

    And the error message you get is? Rather than guessing always start from the actual error message you see. If you don't have any message double check mail you are using the right mail address or that it doesn't go to a Junk mail folder etc...

    Monday, March 2, 2015 5:00 AM
  • User1075652024 posted

    System log don't generate error message and doesn't go to junk or spam folder. Yahoo doesn't like the setting and put the mail in black hole as no rejection or error message; all emails delivered to hotmail, gmail and other smtp services, No problem with any other smtp server, I may be missing some thing which yahoo mail may be looking for.

    Monday, March 2, 2015 5:36 AM
  • User753101303 posted

    You logged to this Yahoo account? For example gmail does sent a message if the message is sent from a unusual location.

    If you are 100% sure you don't have any exception, it means that the message goes to Yahoo. Change perhaps the content to see if it couldn't be classified as spam. Also you likely have a limit (you sent only few messages?)

    For now it doesn't seems a coding issue.

    Monday, March 2, 2015 5:52 AM
  • User1713851783 posted

    Try using the following settings for the Yahoo Mail service

    WebMail.SmtpServer="smtp.mail.yahoo.com";  

    WebMail.SmtpPort =465;

    WebMail.EnableSsl=true;  

    WebMail.UserName="<a valid Yahoo account>";

    WebMail.From="<the same valid Yahoo account";  

    WebMail.Password="<the correct password";

    Monday, March 2, 2015 10:40 AM
  • User1075652024 posted

    Did use yahoo mail service, with two different yahoo email accounts and it did not work for relaying to yahoo email account it worked for other smtp server but not yahoo.  what could be missing with webmatrix settings?

    Monday, March 2, 2015 4:11 PM
  • User1075652024 posted

    As GmGregori suggested to use yahoo smtp server I tried using valid yahoo email addresses but no success in relaying message for yahoo email . I tried on port 465 and 587 but no success. the message wouldn't reach to any folder spam or trash. Messages for other smtp server works fine, but message doesn't reach to the user account who account is being used for relaying message.

    Monday, March 2, 2015 4:21 PM
  • User1713851783 posted

    I have made some tests and this page sends messages without problems:

    @{
        WebMail.SmtpServer = "smtp.mail.yahoo.com";
        WebMail.SmtpPort = 587;
        WebMail.EnableSsl = true;
        WebMail.UserName = "your_address";
        WebMail.Password = "your_password";
        WebMail.From = "your_address";
    
        if(IsPost)
        {
            var email = Request["Email"];
            var mailsub = Request["Subject"];
            var mailtxt = Request["Body"];
            WebMail.Send(
                to: email,
                subject: mailsub,
                body: mailtxt
            );
        }
    }
    
    <!DOCTYPE html>
    <html>
    <head>
      <title>Send Email</title>
    </head>
    <body>
        <div>
            <form method="post">
                <p>
                    <label for="Email">To: </label>
                    @Html.TextBox("Email") 
                </p>
                <p>
                    <label for="Object">Subject: </label>
                    @Html.TextBox("Object") 
                </p>
                <p>
                    <label for="Text">Body: </label>
                </p>
                <p>
                    @Html.TextArea("Body")
                </p>
                <p>
                    <input type="submit" value="Send" />
                </p>
            </form>
        </div>
    </body>
    </html>
    

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, March 2, 2015 7:19 PM
  • User1075652024 posted

    Thanks, I check the code it works fine, I feel may appstart or some other code annoying yahoo. I know its me not yahoo so I will put my codes in order or make some arrangement. Thanks for advising this approach to test the code.

    Tuesday, March 3, 2015 1:29 AM
  • User753101303 posted

    It's strange you don't have any exception. Or could it be that at some point you changed the web.config so that messages are saved to a folder rather than actually sent?

    §have you checked your web.config for https://msdn.microsoft.com/en-us/library/ms164240(v=vs.110).aspx elements?

    Tuesday, March 3, 2015 4:42 AM