Click here to Skip to main content
15,898,222 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: How to send an email ? Pin
Parwej Ahamad27-Jun-08 8:04
professionalParwej Ahamad27-Jun-08 8:04 
GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:16
tina->newcoder27-Jun-08 8:16 
General[Message Deleted] Pin
Parwej Ahamad27-Jun-08 8:17
professionalParwej Ahamad27-Jun-08 8:17 
GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:19
tina->newcoder27-Jun-08 8:19 
GeneralRe: How to send an email ? Pin
Parwej Ahamad27-Jun-08 8:21
professionalParwej Ahamad27-Jun-08 8:21 
GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:23
tina->newcoder27-Jun-08 8:23 
General[Message Deleted] Pin
Parwej Ahamad27-Jun-08 8:24
professionalParwej Ahamad27-Jun-08 8:24 
GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:25
tina->newcoder27-Jun-08 8:25 
Parwej Ahamad wrote:
Are you logged on any IM ?


-> na...

code:
protected void Page_Load(object sender, EventArgs e)
    {
        string server;
        server = "localhost";
            // Specify the file to be attached and sent.
            // This example assumes that a file named Data.xls exists in the
            // current working directory.
            string file = "data.xls";
            file = Server.MapPath("~/data.xls");
            // Create a message and set up the recipients.
            MailMessage message = new MailMessage(
               "apurvkolte@live.com",
               "apurvkolte@gmail.com",
               "Quarterly data report.",
               "See the attached spreadsheet.");

            // Create  the file attachment for this e-mail message.
            Attachment data = new Attachment(file, MediaTypeNames.Application.Octet);
            // Add time stamp information for the file.
            ContentDisposition disposition = data.ContentDisposition;
            disposition.CreationDate = System.IO.File.GetCreationTime(file);
            disposition.ModificationDate = System.IO.File.GetLastWriteTime(file);
            disposition.ReadDate = System.IO.File.GetLastAccessTime(file);
            // Add the file attachment to this e-mail message.
            message.Attachments.Add(data);
            //Send the message.
            SmtpClient client = new SmtpClient();
            client.Host = "smtp.gmail.com";
            client.Port = 465;
            // Add credentials if the SMTP server requires them.
            client.Credentials = CredentialCache.DefaultNetworkCredentials;
            client.Send(message);
            // Display the values in the ContentDisposition for the attachment.
            ContentDisposition cd = data.ContentDisposition;
            Console.WriteLine("Content disposition");
            Console.WriteLine(cd.ToString());
            Console.WriteLine("File {0}", cd.FileName);
            Console.WriteLine("Size {0}", cd.Size);
            Console.WriteLine("Creation {0}", cd.CreationDate);
            Console.WriteLine("Modification {0}", cd.ModificationDate);
            Console.WriteLine("Read {0}", cd.ReadDate);
            Console.WriteLine("Inline {0}", cd.Inline);
            Console.WriteLine("Parameters: {0}", cd.Parameters.Count);
            foreach (DictionaryEntry d in cd.Parameters)
            {
                Console.WriteLine("{0} = {1}", d.Key, d.Value);
            }
            data.Dispose();
       

    }

GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:26
tina->newcoder27-Jun-08 8:26 
GeneralRe: How to send an email ? Pin
Parwej Ahamad27-Jun-08 8:29
professionalParwej Ahamad27-Jun-08 8:29 
GeneralRe: How to send an email ? Pin
tina->newcoder27-Jun-08 8:34
tina->newcoder27-Jun-08 8:34 
GeneralRe: How to send an email ? Pin
Parwej Ahamad27-Jun-08 8:41
professionalParwej Ahamad27-Jun-08 8:41 
Questiondatabase Pin
jds120727-Jun-08 6:09
jds120727-Jun-08 6:09 
AnswerRe: database Pin
NetBot27-Jun-08 6:13
NetBot27-Jun-08 6:13 
GeneralRe: database Pin
jds120727-Jun-08 6:39
jds120727-Jun-08 6:39 
AnswerRe: database Pin
Kschuler27-Jun-08 7:25
Kschuler27-Jun-08 7:25 
AnswerRe: database Pin
Mark Churchill27-Jun-08 16:53
Mark Churchill27-Jun-08 16:53 
QuestionDifficulty Implementing Edit Row with Repeater Pin
Scott MacMaster27-Jun-08 4:49
Scott MacMaster27-Jun-08 4:49 
QuestionSQL Injection advise Pin
dabs27-Jun-08 4:43
dabs27-Jun-08 4:43 
AnswerRe: SQL Injection advise Pin
eyeseetee27-Jun-08 4:52
eyeseetee27-Jun-08 4:52 
GeneralRe: SQL Injection advise Pin
dabs27-Jun-08 5:11
dabs27-Jun-08 5:11 
GeneralRe: SQL Injection advise Pin
NeverHeardOfMe27-Jun-08 5:38
NeverHeardOfMe27-Jun-08 5:38 
GeneralRe: SQL Injection advise Pin
dabs27-Jun-08 6:03
dabs27-Jun-08 6:03 
GeneralRe: SQL Injection advise Pin
NeverHeardOfMe27-Jun-08 6:18
NeverHeardOfMe27-Jun-08 6:18 
QuestionImage Not Refreshing Pin
Member 343561427-Jun-08 4:38
Member 343561427-Jun-08 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.