creating PDF using .NET itextsharp component vb NET

To create a PDF file from any .net application is very easy. You just need to use itextsharp component.  You can download this component http://itextsharp.sourceforge.net

Just import this component namespace to your application. Here is the sample code.

Dim doc as New Document

PdfWriter.GetInstance(doc,New FileStream("Sample.pdf",FileMode.Create))
doc.Open()
doc.Add(New Paragraph(" Add the contects",FontFactory.GetFont(FontFactory.TIMES ROMAN,22,iTextSharp.text.Font.BOLD)))
doc.close()
 
Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

sending email using gmail SMTP server using .NET

If you do not have an SMTP server of your own, you can still send SMTP authenticated emails from your .net application. Just sign up for a brand new gmail account or use your exisiting gmail account.

SmtpClient obj = new SmtpClient("smtp.gmail.com",465);
//465 is the TCP port for sending emails using gmail. 465 is generally used for SMTP with SSL.

obj.EnableSsl = true;
obj.Credentials=new System.Net.NetworkCredential("username@gmail.com", "password");
// your email address and its password for the SMTP authentication

MailMessage Mailmsg = new MailMessage();
Mailmsg.To.Clear();
Mailmsg.From = new MailAddress("username@gmail.com");
Mailmsg.Subject = "Subject";
Mailmsg.Body ="Body";

//adding attachments
Attachment at = new Attachment(Server.MapPath("~/document.doc"));
Mailmsg.Attachments.Add(at);
Mailmsg.Priority = MailPriority.High;
Mailmsg.IsBodyHtml = true;
Mailmsg.To.Add(new MailAddress("mailaddress", "name"));
Mailmsg.BodyEncoding = System.Text.Encoding.Default;
try
{
obj.Send(Mailmsg);
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

sending emails using .NET

You can use the below class to send the emails using asp.net form or any windows based .net applications. This implements the SMTP client to send email.

 public class MyOwnSMTP
    {
        public void SendMail(string From, string To, string Sub, string Body)
        {
            MailMessage Email = new MailMessage(From, To, Sub, Body);
            Email.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient(SMTP server host or IP, 25 or 584);
            smtp.Credentials = new System.Net.NetworkCredential("email address", "password");
            smtp.Send(Email);
        }
    
    }

SMTP server hostname : The host name of your mail server. E.G. servers.a2zorkut.com

EMail address: Any email address hosted under the mail server at  servers.a2zorkut.com

Password: Password of the above email address

From: From email address

To : To email address

Sub : Subject of the email to be sent.

Body: Body of the email to be sent.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList






Quality & Affordable Web Development | About the Author | Hosted By Windows Hosting | Discuss With Experts At Webmaster Forums