locked
[A recipient must be specified] from webmail helper RRS feed

  • Question

  • User-293841989 posted

    I'm using webmail helper to send an email, but it asks for a recipient.

    This is sendMail.cshtml: @{ WebMail.Send( to: Request["email"], subject: "Advertisement confirmation", body: message, isBodyHtml: true ); }

    This is _AppStart.cshtml: @{ WebMail.SmtpServer="smtp.gmail.com"; WebMail.From="example@gmail.com"; }

    This is web.config: 

    <?xml version="1.0"?>
    
    <configuration>
    
        <system.web>
            <compilation debug="false" targetFramework="4.0" />
        </system.web>
        <system.net>
            <mailSettings>
                <smtp deliveryMethod="SpecifiedPickupDirectory">
                    <specifiedPickupDirectory pickupDirectoryLocation="C:\Mail\"/>
                </smtp>
            </mailSettings>
        </system.net>
    </configuration>
    

    Monday, May 23, 2016 2:47 AM

Answers

  • User-821857111 posted

    You need to check to see if Request["email"] contains a value. From the error message, it doesn't look like that's the case.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 23, 2016 6:22 AM