If you want to send email using your Gmail account or using Gmail's smtp server in ASP.NET application or if you don't have a working smtp server to send mails using your ASP.NET application or aspx page than sending e-mail using Gmail is best option.
you need to write code like this
First of all add below mentioned namespace in code behind of aspx page from which you want to send the mail.
using System.Net.Mail;
Now write this code in click event of button
C# code
protected void Button1_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.To.Add("jainamit.agra@gmail.com"); mail.To.Add("amit_jain_online@yahoo.com"); mail.From = new MailAddress("jainamit.agra@gmail.com"); mail.Subject = "Email using Gmail"; string Body = "Hi, this mail is to test sending mail"+ "using Gmail in ASP.NET"; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential ("YourUserName@gmail.com","YourGmailPassword"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Send(mail); }
VB.NET code
Imports System.Net.Mail Protected Sub Button1_Click (ByVal sender As Object, ByVal e As EventArgs) Dim mail As MailMessage = New MailMessage() mail.To.Add("jainamit.agra@gmail.com") mail.To.Add("amit_jain_online@yahoo.com") mail.From = New MailAddress("jainamit.agra@gmail.com") mail.Subject = "Email using Gmail" String Body = "Hi, this mail is to test sending mail"+ "using Gmail in ASP.NET" mail.Body = Body mail.IsBodyHtml = True Dim smtp As SmtpClient = New SmtpClient() smtp.Host = "smtp.gmail.com" //Or Your SMTP Server Address smtp.Credentials = New System.Net.NetworkCredential ("YourUserName@gmail.com","YourGmailPassword") smtp.EnableSsl = True smtp.Send(mail) End Sub
You also need to enable POP by going to settings > Forwarding and POP in your gmail account
Change YourUserName@gmail.com to your gmail ID and YourGmailPassword to Your password for Gmail account and test the code.
If your are getting error mentioned below
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required."
than you need to check your Gmail username and password.
If you are behind proxy Server then you need to write below mentioned code in your web.config file
<system.net> <defaultProxy> <proxy proxyaddress="YourProxyIpAddress"/> </defaultProxy> </system.net>
If you are still having problems them try changing port number to 587
smtp.Host = "smtp.gmail.com,587";
If you still having problems then try changing code as mentioned below
SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = False; smtp.Credentials = new System.Net.NetworkCredential ("YourUserName@gmail.com","YourGmailPassword"); smtp.EnableSsl = true; smtp.Send(mail);
In this example i am going to describe how to send email with attachment in ASP.NET using fileUpload Control.
I am saving the uploaded file into memory stream rather then saving it on server.
And for this example i m using Gmail SMTP server to send mail, this code also works fine with any SMTP Server.
For sending Email in ASP.NET , first of all we need to add Syatem.Net.Mail namespace in code behind of aspx page.
In my previous article i describe how to send mail using gmail in asp.net
Create the page as shown in the image above, put textbox for message and FileUpload Control for adding the file attachment.
Write below mentioned code in click event of Send button in Code behind of page
C# Code Behind
using System; using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net.Mail; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void btnSend_Click(object sender, EventArgs e) { MailMessage mail = new MailMessage(); mail.To.Add(txtTo.Text); //mail.To.Add("amit_jain_online@yahoo.com"); mail.From = new MailAddress(txtFrom.Text); mail.Subject = txtSubject.Text; mail.Body = txtMessage.Text; mail.IsBodyHtml = true; //Attach file using FileUpload Control and put the file in memory stream if (FileUpload1.HasFile) { mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName)); } SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address smtp.Credentials = new System.Net.NetworkCredential ("YourGmailID@gmail.com", "YourGmailPassword"); //Or your Smtp Email ID and Password smtp.EnableSsl = true; smtp.Send(mail); } }
VB.NET Code Behind
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Net.Mail Public Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) End Sub Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As EventArgs) Dim mail As New MailMessage() mail.[To].Add(txtTo.Text) 'mail.To.Add("amit_jain_online@yahoo.com"); mail.From = New MailAddress(txtFrom.Text) mail.Subject = txtSubject.Text mail.Body = txtMessage.Text mail.IsBodyHtml = True 'Attach file using FileUpload Control and put the file in memory stream If FileUpload1.HasFile Then mail.Attachments.Add(New Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName)) End If Dim smtp As New SmtpClient() smtp.Host = "smtp.gmail.com" 'Or Your SMTP Server Address smtp.Credentials = New System.Net.NetworkCredential("YourGmailID@gmail.com", "YourGmailPassword") 'Or your Smtp Email ID and Password smtp.EnableSsl = True smtp.Send(mail) End Sub End ClassBuild and run the application to test the code
Hope this helps
Tanning lamps and tanning bulbs have a realitively long life span - in fact your tanning bulb will seldom die out completely. However, as time goes on, it takes a little longer and then longer still to get their job done. Generally, just as it lives longer, it emits less UV lights..and becomes useless to you eventually. The UV lights, in combination with the wattage, should determine the strength of the lamp you want to use
ReplyDeleteTanning Bed Bulbs :Tanning lamps or bulbs for home or salon tanning beds featuring Wolff Tanning Lamps.
NAFG does not perform any medical services. Donor medical screening and cycling, carrier screening, egg retrieval, IVF (in vitro fertilization) and embryo transfer may be performed at any qualified clinic you choose. NAFG works regularly with the New York University Fertility Center, Center for Reproductive Medicine and Infertility at Cornell University (CRMI), Reproductive Medicine Associates, Brigham and Women’s ART Center, Boston IVF, Reproductive Science Center, and other leading centers across the
DeleteDonor Eggs Surrogacy NY Boston MA :AFG is an independent surrogacy egg donation program in New York City and Boston, committed to creating happy and loving families through egg donation
10 Sexy Kissing Tips
ReplyDelete1. If she is laying down draw one of her arms above her head and lightly hold her hand. Commence by kissing the soft area on the inside of her upper arm – from her elbow down to her chest. For variation, trail the tip of your tongue in a zigzag down this area. This absolutely drives my wife crazy! (submitted by Troy)
2. Kiss her gently near the clavicle (colar bone), then run your tongue in a zig zag up to her ear very slowly. Give her earlobe a little nibble. It’s all in the neck guys… (submitted by Dave)
3. When you’re sitting close to your love, start out by softly stroking their face, slowly move your hand to their mouth then very lightly brush the lower lip with one of your fingers. If they seem to love this, then place the tip of that finger in their mouth. My boyfriend loves this, and sometimes he’ll start sucking my finger a bit. This leads to a great french kiss! (submitted by KC)
4. Gently kiss your partner on the neck, cheek, jaw, and slowly move closer to his/her lips. When you reach their lips, they will be all the more excited to kiss you! My boyfriend sometimes does this and it drives me crazy! (submitted by Christi)
5. Start by pouring a glass of wine. Take a few sips to get the taste in your mouth. When you lead him to bed, bring the wine with you. While kissing him, dip your finger in the wine. Trace his lips and mouth with your wine-soaked finger and lick the wine off slowly and gently. Take your time. Kissing can be very erotic. (submitted by Heather)
6. I play a kissing game with my wife. The object of the game is to make your partner try to kiss you. This could be done by lightly kissing her neck, breathing into her ear, kissing her cheeks, and lightly kissing her lips. Whoever lasts the longest wins! (submitted by Guntes)
7. Sensually whisper something a litte bit naughty in their ear such as “I want you…” or make up your own. Let them feel your breath next to their ear, then kiss it and gently nibble it. Move down towards their neck and back up to their lips. This drives my husband crazy! (submitted by Gloria)
8. When kissing…try to catch his/her upper lip between your lips as you’re closing your mouth, and suck lightly before letting go. (submitted by Ryan)
9. When kissing really passionately, stroke the nape of his neck with your fingers. (submitted by Beth)
10. Think of why you like certain body parts of your love, or why you love to kiss those body parts. For each area, give them a quick kiss there, then whisper why you love that part. Move up and down their body sprinkling them with kisses and sweet words.
high profile escort in mumbai || independent escort mumbai
Milestones accepts both local and out of area residents, with most of the program's participants coming to us from throughout the United States as well as internationally. Located in South Florida, Milestones is near two major airports serving the area as well as in close proximity to a variety of resources and attractions.
DeleteTreatment Eating Disorders