Thursday, December 18, 2014

(C# + VB) SEND EMAIL WITH ATTACHMENTS IN ASP.NET [ FULL SOURCE CODE] TUTORIAL WITH LIBRARIES INCLUDED ON TOPBOTS.BLOGSPOT.COM


Other Non Bot Options:
Can't Afford A Bot? Buy SEO & Social Media Metrics For Cheap Starting at $1 Dollar

 http://a.seoclerks.com/rss?


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 allwe need to add Syatem.Net.Mail namespace in code behind of aspx page.
C# Code Behindusing 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 Class

http://www.plndr.com/?r=9909916&utm_source=invite&utm_medium=referral&utm_campaign=personalurl http://addmf.co/?BGKB7CH http://addmf.cc/?BGKB7CH http://a.seoclerks.com/linkin/252867 http://www.reverbnation.com/c./a4/10232852/3928250/Artist/3928250/Artist/link http://proxypremium.blogspot.com/2014/01/free-daily-proxy-list-txt-download.html Jay%20Stilla







Likes For Free,
Unlimited Likes Bot,
Unlimited Follow Bot,
Email Scrapping Friend Adding Mail Sending Automated Bot,
We Build Bots,
SEO Bot,
Backlinking Bot,
VMware Virtual Social Friend Follow Connect Farming Bot,
Buy iTunes Store Reviews ,
Buy iTunes Store Auto Review Bot,
Buy amazon Store Auto Review Bot,
Buy Google Play Store Auto Review Bot,
Buy Yelp Store Auto Review Bot,
Add Friends,
Friend Adder,
Post Blaster Bot,
Twitter Bot,
Tweet Bot,
Insta Bot Bots,
Robo Bot - Multi Clicker - Automated Macro System,
Free Social Media God Bot,
Facebook God Bot,
Twitter God Bot,,
Wholesale Social Media Follows , LIkes, Post,
Facebook , Twitter , Google , 
Free Proxy Bot,
Free Ip Masking Bot,
Free Apple iTunes Review Bot,
Automated Review Bot,
Fake Reviews Bot,
Fake Reviewer,
Proxy Switcher,
Plays Increaser,
Views Increaser,
Automatic Review, Posting Program,
iTunes Bot,
Multi Task Macro Scirpt Auto Posting Article Bot,
Free Downloads, Master Key Gen Bot, Universal Key Maker Bot,

Free Download The Hunger Games MockingJay : Part 1 Studio Copy Dvd Blu Ray Full HD Movie 2:56.00 1080p Xvid, Dolby 5.1,7.1 Surround Sound Optimized Torrent Download, Full Studio Release, Leaked Copy, Private Screening Copy, Directors Cut, Extra Scenes, High Quality, Ultra Blu Ray Free Movie Download No Cost 100 Seeders 3 Leechers Jennifer Lawrence  Includes Half of The Hunger Games :Rise Of Fire Platinum Edition Part 2 Cam HD Blu Ray True Color 720 p, 1080 p JBL Mastered Audio Interpolated Torrent Movie Download Ultra Blu Ray Bootable Movie Disc

5 comments:

  1. Hi Get the AddmeFast auto bot Download ADDMEFAST BOT => =========>>>> ADDMEFAST BOT DOWNLOAD

    ReplyDelete
    Replies
    1. Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download Now

      >>>>> Download Full

      Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download LINK

      >>>>> Download Now

      Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download Full

      >>>>> Download LINK iG

      Delete
  2. Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download Now

    >>>>> Download Full

    Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download LINK

    >>>>> Download Now

    Top Bots Inc.: (C + Vb) Send Email With Attachments In Asp.Net [ Full Source Code] Tutorial With Libraries Included On Topbots.Blogspot.Com >>>>> Download Full

    >>>>> Download LINK ri

    ReplyDelete

Feel Free To Request Any Content You Would Be Interested In Seeing Featured On TopBots.BlogSpot.Com This Blog is For Intellectual People Who Enjoy Learning New Knowledge And Sharing It With Others Open Source, Public Domain Empowering Light Seekers Of Advance knowledge and Tools And Multiple Levels Realms and Domains. If Would Like To Join The Team And Become A Blog Editor and Writer Feel Free To Request Information Below: Comment Whatever You Desire Its A Free Globe Last Time I Checked. Enjoy and Please Help By Subscribing And Re posting.