473,472 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

[C#] Mail sent through app doesn't show up in Sent Mail

81 New Member
Hi,
Iam using below code for sending a mail, but its not storing in my sent mail option, how can i see that one in sentmail and how can i find that mail size?

Expand|Select|Wrap|Line Numbers
  1.  MailMessage msg = new MailMessage();
  2.         msg.From = new MailAddress((TextBox1.Text));
  3.         msg.To.Add((TextBox4.Text));
  4.         if (FileUpload1.HasFile)
  5.        {
  6.            string fileName =FileUpload1.PostedFile.FileName;
  7.            Attachment myAttachment =
  8.                           new Attachment(FileUpload1.FileContent, fileName);
  9.            msg.Attachments.Add(myAttachment);
  10.        }
  11.         msg.Subject = TextBox2.Text.ToString();
  12.         msg.Body = TextBox3.Text.ToString();
  13.         try
  14.         {
  15.           SmtpClient smtp = new SmtpClient("smtp.gmail.com",587);
  16.            // SmtpClient smtp = new SmtpClient("smtp.mailserver.com");
  17.             smtp.EnableSsl = true;
  18.             smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
  19.           NetworkCredential myCreds = new NetworkCredential("gmail id", "gmail password");
  20.             smtp.Credentials = myCreds;
  21.             smtp.Send(msg);
  22.             Label4.Visible = true;
  23.             Label4.Text = "Mail Sent Successfully";
  24.         }
  25.         catch (Exception exc)
  26.         {
  27.             Label4.Visible = true;
  28.  
  29.             Label4.Text = "Failure Message: " + exc.Message.ToString();
  30.         }
Jul 2 '08 #1
1 938
Curtis Rutland
3,256 Recognized Expert Specialist
As a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).

This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.

Please use the tags in future.

Also, more descriptive titles will help you get better responses.

MODERATOR.
Jul 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: pee2pee | last post by:
Hi, I have below code: <html> <head> <title>Contacting Worldpay, Please wait.......</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body...
11
by: JN | last post by:
Hello, I use an ASP mail object to send orders filled online to a recipient via an e-mail. I would like to know if it's possible to format the way the order looks in an e-mail? I tried the...
16
by: polilop | last post by:
I made a form in which I send the visitor a link to my page but when the visitor gets that link in the mail it dosent send him to the page just says invalid syntax or something like...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
3
by: Ivan Weiss | last post by:
I have an application where employees fill out forms and they are e-mailed to the responsibility party once completed. I was planning on using Microsoft Outlook (since everyone uses it for office...
6
by: Geoff Berrow | last post by:
I'm doing a bit of work for a guy and on his system the mail() function always returns false, but the mail is sent. Anyone come across this? Any ideas what is causing it and how to fix it? --...
34
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
11
by: ibiza | last post by:
Hi all, I am trying to use the System.Net.Mail class for the first time, with ASP.NET 2.0. I setup everything according to http://www.codeproject.com/aspnet/EasySMTP_package.asp, which gives...
1
by: William Connery | last post by:
Hi, I have a small python program with e-mail capabilities that I have pieced together from code snippets found on the internet. The program uses the smtplib module to successfully send an...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.