Email Application problem

Hello forum member,

i have no idea Email application.is it simple email programe from where i send a mail or different.

please clear it for me with a small demo.

Thanking you.

0
salman
12/23/2008 6:13:54 AM
asp.net.getting-started 91979 articles. 3 followers. Follow

22 Replies
599 Views

Similar Articles

[PageSpeed] 27

Hi use this function test it using gmail account

usingSystem.Net.Mail;
then use this function

public Boolean sendemail(String strTo, string strFrom, string strSubject, string strBody, bool IsBodyHTML)
{
Array arrToArray;
char[] splitter = { ';' };
arrToArray = strTo.Split(splitter);
MailMessage mm = new MailMessage();mm.From = new MailAddress(strFrom);
mm.Subject = strSubject;
mm.Body = strBody;
mm.IsBodyHtml = IsBodyHTML;
foreach (string s in arrToArray)
{
mm.To.Add(new MailAddress(s));
}
SmtpClientsmtp = new SmtpClient();
try
{
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = Your gmail email;
NetworkCred.Password = Your gmail password;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 465;
smtp.Send(mm);
mm = null;
smtp = null;
return true;
}
catch (Exception ex)
{
smtp = null;
return false;
}
}


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/23/2008 7:42:30 AM

Hi,

Thank you for your response and your code.but where i use it in my application?

can i create a new account here and check my email?is it a Email aplication?what is the diffence between email application and simple email?

please clear me.

Thanking you.

 

0
salman
12/23/2008 8:26:53 AM

the above code can be used to send out mails from an asp.net application. you can send mail from any account to any account. for example from bill.gates@microsoft.com to steve.jobs@apple.com.


Jerry Joseph
IT Consultant

Microsoft Certified Technology Specialist in .NET Framework 2.0 Web Applications

View Jerry Joseph's profile on LinkedIn


~ Please Mark as Answer if it solves your query ~
0
jerryjoseph
12/23/2008 8:31:50 AM

Create or use ur exsting gmail accounr credentials to send emails using the above function

You can call the function in ur application to send emails using the specified account

 


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/23/2008 8:38:25 AM

ok,but what is meaning of Email Application and diffence between general email application.

Thanking you.

0
salman
12/23/2008 9:00:59 AM

Application which uses an smtp server to send emails


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/23/2008 9:11:35 AM

Hi,

an error come when i run your function that is "The operation has time out".

how i over come.please help me.

Thanking you.

0
salman
12/24/2008 4:27:26 AM

 Operation Timed Out occurs when ur smtp server is not reachable. check ur smtp server which u r using?? Also the incorrect port no can also cause this


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 4:43:56 AM

Hi,

how i know my SMTP port no.is it different in each system?

Thanking you.

0
salman
12/24/2008 4:47:57 AM

Smtp port no is for smtp server and not for each system hence it will be same for all machines. If u dont know try commenting the code where it accespts port no. If ts work fine else cotact ur IT Team to provide u credentials


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 4:52:54 AM

Hi,

Thank you for your replay.

again another error come that is "Failure sending mail".

Thanking you.

0
salman
12/24/2008 5:16:16 AM

Try to change this to false

smtp.EnableSsl = false;


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 5:22:07 AM

here is my code,

protected void Button1_Click(object sender, EventArgs e)

{

sendemail(txtEmail.Text, txtName.Text, txtMessage.Text, txtMessage.Text,
true);

}

0
salman
12/24/2008 5:22:11 AM

No, same error.

Thanking you.

0
salman
12/24/2008 5:55:57 AM

Can u try out using gmail acount settings if its works then the issue is ur server settings


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 6:17:26 AM

Hi,

Thank you for your response.i think there are some mistake in our server setting.could you describe which error it may be?

secondly,could you send me the complite email application i.e,Attachment,formating the body,etc.

Thanking you.

0
salman
12/24/2008 6:32:03 AM

Hers's the attachment code also

public Boolean sendemail(String strTo, string strFrom, string strSubject, string strBody, bool IsBodyHTML)
{
Array arrToArray;
char[] splitter = { ';' };
arrToArray = strTo.Split(splitter);
MailMessage mm = new MailMessage();mm.From = new MailAddress(strFrom);
mm.Subject = strSubject;
mm.Body = strBody;
mm.IsBodyHtml = IsBodyHTML;
foreach (string s in arrToArray)
{
mm.To.Add(new MailAddress(s));
}

Attachment attachFile = new Attachment("c:\\abc.doc");

mm.Attachments.Add (attachFile);


SmtpClientsmtp = new SmtpClient();
try
{
smtp.Host = "smtp.gmail.com";
smtp.EnableSsl = true;
System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();
NetworkCred.UserName = Your gmail email;
NetworkCred.Password = Your gmail password;
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 465;
smtp.Send(mm);
mm = null;
smtp = null;
return true;
}
catch (Exception ex)
{
smtp = null;
return false;
}
}

 

now to get a formatted body write html in ur body in the following way

strBody = "<span style='font-weight:bold;color:Red'>MAK</span>"

 in this case you will get an HTML formatted body

check ur server settings for

PortNo, SSL Settings, Server Name

 


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 6:50:28 AM

Hi,

Thank you very much for your replay.i think your code is hard-coded.how can i develop a user friendly.

for example,how a user can formatting the body as he want.

Thanking you.

0
salman
12/24/2008 7:30:04 AM

then u will need a texteditor like this site www.asp.net for ur body has which you use to reply. It converts the text as fomatted html and then submits


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 7:39:35 AM

Hi,

How i do this? is it a third party control or how i make a texteditor.

Thanking you

0
salman
12/24/2008 7:52:11 AM

Hre u can read this

http://www.usingjavascript.com/scripts/richtexteditor.html

http://freerichtexteditor.com/

http://www.codeproject.com/KB/scripting/w3richtechedit.aspx

http://www.fluffy.co.uk/stediting/

Please dont forget the my post as answer so that others can refer too


MAKMark as Answer if this reply helps you
MVP ASP/ASP.Net
MVP ASP/ASP.Net
ASP.Net Hosting : Host DepotMy Site : ASPSnippets
0
mudassarkhan
12/24/2008 8:02:21 AM

Hi,

Thank you very much for your support.it will help me.

thank you very much.

Thanking you.

0
salman
12/24/2008 8:21:22 AM
Reply:

Similar Artilces:

Getting started with .net mobile/wireless application programming
Hi friends, I am very much amateur to the world of mobile/wireless application programming that's why m is having thousands of doubts and confusion regarding the technology. My first few concerns about the terms i.e. mobile web applications vs. windows mobile applications first thing are these 2 things are same if not what are the main differences. I hope you will also show me some light how to move further ahead in this field as i m having small exp approx. 1.5 yrs in Asp.net application. Any help in the form of links, URL, code will be highly appreciated. Thanks in advanced...

Starting an Ajax.net Application in .net
i am new to ajax.net could any one give me simple ajax,net example so that i start building on my ajax skills please.........  I started with the todolist video on the main asp.net/ajax page, and its all you need to know to get started. http://download.microsoft.com/download/0/f/6/0f651a0f-6f2b-4497-b061-e1b2825e22e0/MSAJAX-ToDoList.wmv Don't forget to click "Mark as Answer" on the post that helped you.This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped. http://asp.net/ajax/    ...

getting email account of a particular user of outlook express in to .NET application..
Hi,  I want to retrieve the  a particular user email account of outlook express in to my .net application.Please help me. Hi, Based on my experience, if you develop a windows application, I suggest to use "Linq" to get the particular user accounts. Please refer to the following code. .cs file import the namespace using Microsoft.Office.Interop.Outlook;            _Application outlook = new Microsoft.Office.Interop.Outlook.Application();           &nb...

getting problem in deploy the >net WebForm application on 3rd party host server
Hi every body, I have deployed successfully a pb 11.5 application to .Net WebForm. But i don't know how to deploy it in 3rd party Host server. Can u give me the dll list , help me my explaining me the step to do it . There's a chapter in the "Deploying Applications and Components to ..Net" called "Deploying and running a .NET Web Forms project" that contains instructions for that: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00586_1150/html/dplynet/CHEJJABD.htm On 18 Sep 2009 07:53:41 -0700, chinmaya wrote: >Hi every bod...

Problems while porting .Net framework 1.0 (VB.Net) application to .Net Framework 1.1
Hello,   I have a ASP.Net web application,written in VB.Net,developed on .Net Framework 1.0 .I am trying to port it on to .Net framework 1.1.   For achieving this,I follow the following steps-   1.Open the project using the .vbproj file. 2.I am prompted with the conversion message "Do you want to convert the solution and all projects to .Net framework  1.1....." 3.I click "Yes" 4.I assume that the project is now converted. 5.I build the project & try to run it. 6.I get the following error -     Server Error in '/Consert.Net' Application. ...

Problem Getting Started
In have run the 1317set.bat file and still get the following error: Unable to get your db version please run version script against your db and restart your web application (go to update/scripts/ folder and run 1317set.bat). Any help to get me started would be much appreciated.www.creativenrg.co.uk | www.therivercard.com Have you checked your connection string? This is sometimes caused by a faulty db connection. I am new to Rainbow and get the same error when trying to run it for the first time. Does not matter which of the following I comment out in web.config: <!-...

.Net Application generators
There are a few .Net complete n-tier application generators that generate directly from your database. Some even have their own database building tools. They are great and easy to follow and their applications generate real VB.Net and C# code, easy to learn. These are great starts for .Net stuff except for one thing, PRICE. Iron Speed is about $1500 and for the same exact product features ASPNetNow sells for only $279 for their Web Matrix version or $530 for VS version. Another company Avalanche sells for $995. Amazing price ranges. The first two match feature for feature except the first yo...

Getting "Problem in Mapping Fragment starting at line ..." error when trying to create table mappings for table associations in ADO.NET Entity Framework
 Table A: COUNTRY_LOOKUP COUNTRY_ID   smallintclustered, unique, primary key located on PRIMARY    COUNTRY_ID TABLE B: COUNTRY_MODE_RULES CARRIER_ID    intMODE_RULE_TYPE_ID    intORIG_COUNTRY_ID    smallintDEST_COUNTRY_ID    smallint clustered, unique, primary key located on PRIMARY    CARRIER_ID, MODE_RULE_TYPE_ID, ORIG_COUNTRY_ID, DEST_COUNTRY_IDThere is a foreign key relationship from COUNTRY_MODE_RULES to COUNTRY_LOOKUPORIG_COUNTRY_IDREFERENCES .COUNTRY_LOOKUP (COUNTRY_ID)DEST_CO...

Sending an Email with system.net.mail -- problem with strings and body of the email.
Hi,I am trying to email the contents of a contact form such that the email body looks like this:Last name: Smith First name: John Comment: Test comment. I am using the MailMessage object.I am storing the textbox values in strings://assign values from form to variables   string first = textboxFirst.Text;   string last = textboxLast.Text;   string comment = textboxComment.Text;and then combining the strings into one string for my MaiMessage.Body property.  //create message body from textbox variables     string message = "Last Name: "  + l...

Problems getting started!
Hi,  I'm having some trouble getting started. Installed visual studio 2005 ex on my pc, installed ASP.NET Ajax extensions on my pc. Toolkit and everything previews in browser fine with full ajax functionality. Framesworks 1.1, 2.0, 3.0 all installed also. Everything apart from visual studio 2005 installed on new web server. Copy web site to server, no ajax page will work? "could not load file or assembly AjaxControlToolkit or one of its dependencies. The system cannot find the file specified" The file is in the bin folder!   Can anyone help? Thanks... Hi unkle, can you ...

Getting email problem
hi i'm trying to send an email in asp.net using C#.net.but i'm getting some kind of error here is the code and the error protected void Button1_Click(object sender, EventArgs e) { System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text); System.Net.Mail.SmtpClient mySmtp = new System.Net.Mail.SmtpClient("192.168.1.118"); try { mySmtp.Send(message); txtTo.Text = ""; txtFrom.Text = &q...

Getting started problem.
I will try to be brief here is my web page layout. It is a pre existing page I updated it Atlas TreeView  |  Buttons  Select All   Deselect  Download                  |  Data Grid fils based on selections from Treview. Goal: to stop the flash that occurs to the treeview and the buttons when the DataGrid is updated. The tree view is already limited to not call the server until its time to load the DataGrid and that works great. No repainting the entire...

I have the problem in email application
I have developed a simple application to do emails to different users. But one thing i cannot understand is that after my application sends email, this email is placed in Queue folder but i cannot recieve that emailOne more thing i want to know that what are the available free smtp server by using which my application can send email to all the internet users. Define "cannot receive".  Check the SMTP logs for help in why the mail is int he queue.  Check DNS and SMTP mailer settings as well. As for free SMTP servers, you won't find any outside of your host or ISP.  They'd al...

Had some problems getting it to start
Name: Pontus Ottosson Email: pundanatgmaildotcom Product: Gran Paradiso Alpha 1 Summary: Had some problems getting it to start Comments: Had some problems getting Minefield to work. It crashed on startup, eventually used a program that searches for old system files (findold.exe) that found a non working Active-X file that I deleted. It now works, Microsoft-bug. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061214 Minefield/3.0a1 ...

Web resources about - Email Application problem - asp.net.getting-started

Application - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

The Bachelor 2016 application process can get explicit - Laurina Fleure
CHANNEL Ten is calling on singles to sign up for a chance to find love on The Bachelor , but willing applicants have to open a lot more than ...

Would you give up chocolate for better application performance?
Application performance is critical to business performance according to 98 percent of businesses, yet 89 percent of executives say the poor ...

Gun Sales, Concealed Permit Applications Surge After San Bernardino
The day after Syed Farook and Tashfeen Malik opened fire in San Bernardino, gun sales and concealed carry permit applications surged.

MBA: Mortgage Applications Increase in Latest MBA Weekly Survey, Purchase Applications up 29% YoY
From the MBA: Mortgage Applications Increase in Latest MBA Weekly Survey Mortgage applications increased 1.2 percent from one week earlier, ...

Falling Costs, Rising Applications Will Boost US Energy Storage Market
... in 2013 to 3,659MWh by 2020 on improving economics and policy developments, predicted GTM Research's Shayle Kann Falling Costs, Rising Applications ...

Mortgage applications down 0.2%
Mortgage interest rates haven't moved much in the past three weeks, but they are holding at a higher level than for all of 2015.

California Film & TV Tax Credits Applications Dip In New Small Screen Round
With production on the uptick in the home of Hollywood , the second round of those seeking small screen Golden State tax credits saw 32 applications ...

Digitimes Research: China touch panel makers increasing investments in niche products and large-size ...
The China International Touchscreen Exhibition (C-Touch) was recently held in Shenzhen, China, featuring a number of local and international ...

Six internet-of-things applications in big new government trial
Manchester, England, is set to be the UK demonstrator city for internet-of-things innovation. Of course, there is much smart technology already ...

Resources last updated: 12/11/2015 1:55:54 AM