Hello,
How to open email dialog from JavaScript?
I am not an expert when it comes with JavaScript I am just a newbie.
Can you give me some tips on how to open email dialog from JavaScript?
I really need your help. Give me a solution.
Thank you
How to open email dialog from JavaScript?
Hello Scottirussells,
Please let me help you with the issue on your programming project. Here’s my suggestion, hope it helps.
<htmlxmlns="https://www.google.com/?gws_rd=ssl">
<head>
<metahttp-equiv="Content-Type"content="text/html; charset=iso-8859-1"/>
</head>
<body>
<formname="emailwindow">
<inputtype="button"value="Mail Me [email protected]"onclick="self.location='[email protected]'"/>
</form>
</body>
</html>
HTH.
How to open email dialog from JavaScript?
Hi,
I am giving you several codes, and this is an example how to get a webmail that let user to submit a page to another page and after finish it will send an email. The first step is to create a page, we call it “_AppStart.cshtml” , after the file created, input code:
@{
WebSecurity.InitializeDatabaseConnection("Users", "UserProfile", "UserId", "Email", true);
WebMail.SmtpServer = "smtp.example.com";
WebMail.SmtpPort = 25;
WebMail.EnableSsl = false;
WebMail.UserName = "[email protected]";
WebMail.Password = "password-goes-here";
WebMail.From = "[email protected]";
}
Second step is to create another page with name “Email_Input. cshtml”. This page created to store information and submit data to another page so it can use the data to send us email. Put this code below in the page.
<!DOCTYPE html>
<html>
<body>
<h1>Request for Assistance</h1>
<form method="post" action="EmailSend.cshtml">
<label>Username:</label>
<input type="text name="customerEmail" />
<label>Details about the problem:</label>
<textarea name="customerRequest" cols="45" rows="4"></textarea>
<p><input type="submit" value="Submit" /></p>
</form>
</body>
</html>
}
The last step for this is create pages to send email, you can give a name to it “Email_Send. cshtml”. Same at every step, put the code into the page.
@{ // Read input
var customerEmail = Request["customerEmail"];
var customerRequest = Request["customerRequest"];
try
{
// Send email
WebMail.Send(to:"[email protected]", subject: "Help request from – " + customerEmail, body: customerRequest );
}
catch (Exception ex )
{
<text>@ex</text>
}
}
If you want to know further about everything I mentioned above, you can go here.