What is the effective way to Send an Email using SmtpClient Class?

Hi Everyone
What is the effective way to Send an Email using SmtpClient Class.
Thanks

Hi Shaheena
The SmtpClient class is used to send e-mail to an SMTP server for delivery.
This is sample code for sending an email through SMTP
void sendEmail(string strFrom
, string strTo
, string strSubject
, string strBody)
/// Author, Md. Marufuzzaman
/// Created,
/// Local dependency, Microsoft .Net framework
/// Description, Send an email using (SMTP).
MailMessage objMailMessage = new MailMessage();
System.Net.NetworkCredential objSMTPUserInfo =
new System.Net.NetworkCredential();
SmtpClient objSmtpClient = new SmtpClient();
try
objMailMessage.From = new MailAddress(strFrom);
objMailMessage.To.Add(new MailAddress(strTo));
objMailMessage.Subject = strSubject;
objMailMessage.Body = strBody;
objSmtpClient = new SmtpClient("172.0.0.1"); /// Server IP
objSMTPUserInfo = new System.Net.NetworkCredential
("User name", "Password","Domain");
objSmtpClient.Credentials = objSMTPUserInfo;
objSmtpClient.UseDefaultCredentials = false;
objSmtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
objSmtpClient.Send(objMailMessage);
catch (Exception ex)
{ throw ex; }
finally
objMailMessage = null;
objSMTPUserInfo = null;
objSmtpClient = null;
Indul Hassan
Microsoft Community Contributor
http://www.indulhassan.com
You Snooze.. You Lose !!

Similar Messages

  • What is the best  way to send one email for 2000+ address?

    Hi I want to send oneemail msg (only text) from mor than 2000 address.
    I want that the recp. will not c the other address (i. e. each address should be a BCC)
    what is the best way to do it? sned 2000 emails or to send 20 emails with 1000 recp. ?
    is there any limitation on the number of recp in BCC?
    10x alot Yonatan

    is there any limitation on the number of recp in BCC?
    mail server you are using may be the limiting factor. However, most mail server handle 2000 recp. You will get smtp error 552 if the mail server cant handle 2000 recipients.

  • What is the easiest way to send an email in JSF application

    Hi Everyone,
    I need an email service in my JSF app for password request. What is the best way to do this in JSF?
    Thanks in advance,

    coudl use a JSP tag lib? plenty out there
    http://java.sun.com/developer/technicalArticles/javaserverpages/emailapps/

  • What are the good ways to send a big file( 20MB-100MB) file to my friend?

    what are the good ways to send a big file( 20MB-100MB) file to my friend?
    Thanks in advance

    if this is with the internet, iChat is probly your best bet,
    but if you just want a transfer,
    plug a firewire into both of your computers, shutdown one of them, hold "T" and press the power button, the restarted computer should pop up as an external drive on the second computer.

  • What is the easiest way to send photos from my PC to my Ipad?

    What is the easiest way to send photos from my PC (Windows 7, Live photo gallery)_ to my Ipad2

    I would use DropBox if you want to transfer your whole photo library.  The iPad is set up to make it very difficult to transfer content off of it.  This is to protect copyrighted materials and prevent file sharing.
    Make sure you have the latest copy of DropBox on your iPad and it will automatically upload all your photos and videos to the Camera Uploads folder on DropBox.  Keep in mind this may take a long time to get them all uploaded, especially if you have a lot of videos and a slow WiFi connection.  It won't work over 3G / 4G must be a Wifi connection.  Once they are uploaded to Dropbox it is simply a matter of then downloading them to the place you want to download them to.

  • What is the best way to manage multiple ipods using the same itunes?

    Hi Everyone
    i am trying to manage three different ipods through the one Itunes, all with very different tastes, not sure if I am doing it the best or easiest way so does anybody have a simple solution on what you're supposed to do, to keep it all simple!
    Cheers
    Liv

    If you have created a new Windows user account you need to log out and then log back in with your original user name. By default each Windows profile will have an independent iTunes library.
    If instead you managed to create a new library within the same profile. click the icon to start iTunes and immediately press and hold down the shift key, keep holding until asked to create or choose a library. Click Choose and navigte back to your original which should be at <User's Music>\iTunes.
    Your question as posed was:
    What is the best way to manage multiple iPods using the same iTunes {library}?
    in which case Selected Playlists is probably the best approach. Simply create a playlist for each device, Alice's iPod, Bob's iPhone etc. and sync the device with the appropriate list.
    tt2

  • What is the best way to make drawings an notes during class (on my iPad), which I can add to my (digital) handout later on?!

    What is the best way to make drawings an notes during class (on my iPad), which I can add to my (digital) handout later on?!

    Hello BDAqua, thanx for the suggestions. Before I saw this reply I tried to first quit the finder and then to relaunch the Finder but that resulted was a blank gray screen.
    In the end I ended up having to power down the iMac.
    Fortunately the RAID array that was "active" seems to be fine and also has a firewire 800 connection so I can use it_ just not with thunderbolt until this issue is solved.
    I'm going to check in the Applications>Utilities>system log to see if any clues are evident_ thank you for the suggestion.
    PS: Nothing of note was obvious as a root cause in the Activity Monitor though.
    hmmm....I was told that the Helios and seritek card were compatable and that the Helios didn't require any drivers..it will be a drag if there isn't an easy fix for this since this new PCIe card from seritek is the first to offer port multiplier compatibility for eSATA to thunderbolt...since they are both new I'm hoping that an OS upgrade will be the fix (presently7.2)...we shall see.

  • What's the best way to prevent KDE from using pulseaudio?

    What's the best way to prevent KDE from using pulseaudio if it is required to be installed for gnome?

    KDE system Settings > Mulitmedia  (in Hardware category) > Audio and Video options > Audio Playback
    the default device shown there is the pulseaudio device, move it to the bottom of the list
    Check all sub entries under Audio Playback to make sure they all have default at the bottom.
    This SHOULD make KDE sound subsystem use the real hardware directly through Alsa instead of pulseaudio.

  • What is the best way to avoid latency when using the io plug in?

    What is the best way to avoid latency when using the io plug in?

    Hi colin a.
    Welcome to the Support Communities!
    The article below may be able to help you with this.  Click on the link to see more details and screenshots. 
    Logic: About I/O buffer size and monitoring latency
    http://support.apple.com/kb/ht1314
    Cheers,
    - Judy

  • What is the best way to send a file?

    i am writing a program and i want to transfer a file from a client class to a server class... what is the best way to do that?
    convert the file to bytes using the following
    File file=new File("jobs.xml");
               byte buffer[]=new byte[(int)file.length()];
               try {
                    BufferedInputStream input=new BufferedInputStream(new FileInputStream("jobs.xml"));
                    input.read(buffer,0,buffer.length);
                    input.close();
               } catch(Exception e) {//DIORTHOSE TA MSGS
                  System.out.println("reading jobs.xml->buffer: "+e.getMessage());
                  e.printStackTrace();
               firstServerRef.translationService(theCallbackObjectRef, buffer);for a reason i dont like that i am reading the file again to put it in the buffer and send the buffer... are my worries reasonable or not? is there any other better way to do that?

    Use a smaller buffer, repeatedly read and
    write, and print the exception's stack trace.
    What do you mean by reading again, by the way? I only
    see you reading the file once.hmm you mean use a smaller buffer and call the function with the smaller buffer many times in a while?
    the client and the server are not on a single machine and i want to call the function only once... could you clarify the thing that you said..
    yes you are correct that you see only one reading because i haven't pasted the rest of the code which is sth like...
    FileWriter fw = new FileWriter("jobs.xml");
               ObjectOutputStream out = xstream.createObjectOutputStream(fw);
         //      out.writeObject(new Jobb("ougk2", "Walnes",null));
              for(int i=0;i<nameOfServices.length;i++){
                   Jobb translationJob=new Jobb();
                   //find the service !
                 NameComponent nc = new NameComponent(nameOfServices, " ");
    // Resolve the object reference in naming
    NameComponent path[] = {nc};
    //create a ref for the servant of the service
    ServiceOperations theRemoteObjRef = ServiceHelper.narrow(ncRef.resolve(path));
    // JobOperations theRemoteObjRef = JobHelper.narrow(ncRef.resolve(path));
    translationJob.setObjServerRef(theRemoteObjRef.toString());
    if(i==0){ //this is the first job
         translationJob.setForTranslation(wordForTranslation);
         firstServerRef=theRemoteObjRef;
         out.writeObject(translationJob);
         out.close();
         File file=new File("jobs.xml");
              byte buffer[]=new byte[(int)file.length()];
              try {
                   BufferedInputStream input=new BufferedInputStream(new FileInputStream("jobs.xml"));
                   input.read(buffer,0,buffer.length);
                   input.close();
              } catch(Exception e) {//DIORTHOSE TA MSGS
         System.out.println("reading jobs.xml->buffer: "+e.getMessage());
         e.printStackTrace();
              firstServerRef.translationService(theCallbackObjectRef, buffer);
    which i believe is bad....

  • What is the best way to send multiple pdf files to my ipad

    what is the best way or app to send multiple pdf files to my ipad, so that I can then combine them into one folder

    I have the app Readdle Docs. It allows you to move PDF files to your device and to move them around on your device. Might check it out. ( I think there's an iPad version of the app, but I have the iPhone version and it works, just not as pretty)
    THere's also Goodreader, but I don't have experience with it to know if it has folder abilities.

  • What's the best way to send photos to a PC user?

    I'm new to the Mac world and need to know the best way to send photos to a PC user.

    Most if not all email have "Attachments" listed in the email menu.  Just click on it & follow the onscreen instructions.  Very simple. 

  • What is the easiest way to create alias email addresses in exchange 2013?

    For example my official domain is [email protected]
    Within my company i want to make it look like certain departments are sending from bicycles.com skateboards.com
    and skooters.com and receive to those addresses even though the emails are really going through the
    [email protected] domain. but it appears to be coming from three other domains.
    appearance is everything. What is the easiest way to accomplish this.
    Step by step with examples if possible. I am not well versed in exchange server 2013 yet.
    Droid Hacker

    In Exchange 2013 you can use the ECP to add additional email addresses to mailboxes. In order for a mailbox to send using an address, that address needs to be set as the reply address. One mailbox cannot send as multiple addresses. Doing that would require
    a mailbox for each address. To set a new primary address on a mailbox log into the ECP and choose mailboxes under the recipients option on the left. Then search for the mailbox you want to add the address to and click the edit symbol. Navigate to the
    Email Address tab on the left. To set a new primary address you will likely need uncheck the box for "Automatically update email addresses based on the email address policy applied to this recipient". Then click the plus button, enter the new address,
    and check the box for "Make this the reply address"
    Before you do this you should ensure that the proper MS records exist for these other domains, and that they are properly configured for mail flow. Once you set this as the reply address for a mailbox, that is the address external users will use for replies.

  • What is the best way to deploy/update custom security realm classes to WLS 6.0?

    From the WLS 6.0 console, I see that I can specify the Java class that
    implements my custom security realm but I am wondering what is the best way
    to deploy/update this code. I don't see a way to do this from the console.
    Does this mean that I have to manually copy the class files over that
    implement my custom security realm?

    Thanks Danut,
    A jar file seems to be a good way to package it up but it sounds like it
    still needs to be manually copied to each Weblogic server install directory
    post-installation and whenever it is updated. I thought it would be nice to
    be able to deploy/update the custom security realm by uploading it through
    the Console just as you can with web applications and EJBs.
    Brian
    "Danut Prisacaru" <[email protected]> wrote in message
    news:3aba2db0$[email protected]..
    You have to have your Custom Realm class in the class path. I usually havea
    jar file with all the Custom Realm classes and that jar I copy it in thelib
    folder. Then I modify "startWebLogic.cmd" and I add to the classpath
    ".\lib\CustomRealm.jar"
    set
    CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;.\lib\CustomRealm.jar;
    >
    Be aware that in order to have you custom realm besides creating thecustom
    realm using the console you also have to create a custom caching andchoose
    that one as your default caching realm.
    Here is how the security settings are looking in my "config.xml"
    <CustomRealm Name="CustomRealm"
    RealmClassName="Custom.appserver.weblogic.security.CustomRealm"/>
    <CachingRealm BasicRealm="CustomRealm" CacheCaseSensitive="true"
    Name="CustomCachingRealm"/>
    <Realm CachingRealm="CustomCachingRealm" FileRealm="wl_default_file_realm"
    Name="wl_default_realm"/>
    <FileRealm Name="wl_default_file_realm"/>
    <Security GuestDisabled="false"
    Name="mydomain" PasswordPolicy="wl_default_password_policy"
    Realm="wl_default_realm"/>
    Danut

  • What is the best way to send large, HD video files from the iPad?

    Hello,
    My department is looking to purchase between 50 and 150 new iPads. We hold conferences where participants take short, 3-minute videos of themselves in situations they have been trained for. The idea was that after they have taken the video, they could simply email these videos to themselves, negating the need to hook the device up to a computer, transfer the video over to a flash drive, and ensure that drive gets back to the right person.
    Now that I have the first one, I'm finding any video longer than 45s or so can't be sent via email because it's too large.
    Are you kidding?
    The file I was just able to send was 7.5MB. That's the biggest video I can send from this thing? Why even give us the ability to take HD video if we can't *do* anything with it?
    But, I digress.
    What I'm looking for is the best way to get video off the iPads and into the hands of our participants. Are there apps on the App Store which might convert whatever video we take to an emailable size? I thought about setting everyone up with Apple IDs and having them use iMessage since there is no limit on file size, but of course you must own an Apple device in order to do that, and it still doesn't solve getting it on their computers.
    Any help here would be greatly appreciated.
    Thanks!
    --Rob

    You could try uploading them to a joint dropbox account that they could then download them from....but how fast it is will depend on the internet connection available.

Maybe you are looking for

  • How can I control what music is stored on my iPhone?

    Apple has decided that all the music I purchase from them is going to be constantly changing disorganized mess of deleted songs and placeholder albums and is controlled by it's own zombie scheduling. I makes me very, VERY angry. I see two options, ri

  • Seeking some straight answers on "share everything" and mobile hotspots

    Hello all; I get a sense from reading other posts that the "share everything" plan is -- to say the least -- not going over too well among most Verizon customers.  However I'm one case for which I think it might actually be beneficial.  Here's the fa

  • Can i set a node manager serve for 2 domain on one machin??

    My question is simple. I installed webcenter suite and soa suite in a machine using difference linux user and difference middleware home. and I want to set a node manager server for two domains (soa_domain and webcenter_domain). Is is possible? When

  • How to handle Invalid characters(Square Box) in BI

    Hi All, Daily I am  getting Invalid character(Square Box) issue with 0Material description and material manufacture part number when the it is being loaded to targets. This data is being loaded to many data targets and daily they are being failed . I

  • Airport Extreme + airport express - problem outputting to multiple speakers

    Hello, I have set up my airport express by joining my existing Airport Extreme base station wireless network. When I play my music in iTunes, I am able to select either the Computer or Airtunes for the output in the drop down box in the lower right o