.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan
Asad Ali
Post New Web Links

Testing Emails Sending (SMTP) under IIS7 Express (WebMatrix)

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :ASP.Net
 

Hi there,

I don't have web server account yet so I must test my applications with the Web Development Server under VS 2010 with C# but I read that I couldn't send emails under that server but I also read that I can send email with IIS7 Express and that's the main reason why I've install Webmatrix. Maybe someone can confirm this.

So for the moment I am redirecting my emails into a local folder and it is working perfectly.

Here is part of the code I've add to the Web.Config for doing that.

</system.web>
<system.net>
  <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="D:\Temp"/>
      </smtp>
  </mailSettings>
</system.net>


 

As you can see I am redirecting the emails to the D:\temp

 
The following code for sending emails comes 
from the videos of JOE STAGNER at Microsoft
but beware there is a few typing errors in 
his video like missing > " 

http://www.asp.net/security/videos/implement-the-registration-v


View Complete Post


More Related Resource Links

smtp server 5.1 in xp not sending emails

  

hi iam using asp.net 2.0 with c#.net.

in my application when client completes its shopping email will goes to user this works fine when there is internet connection is working fine,
if  there is some problem  in internet connection if one mail stops then all the mails will be stopped even now internet works fine,

how to resend the emails using smtp server, is there any option to resend the emails automatically when internet works fine.


can you give example which helps me.


smtp is noe sending email instantly,it makes a Queue in my local system

  
I am using a  smtp to send email from asp.net (C#)code.it sending some email instantly but many of email is making a queue in my Inetpub folder at local system.what could be the issue ? please help me to get rid from it.ThankxArvind

Sending Asynchronous emails from Asp.Net Web pages

  
Hey Guys, Here is my situation and hopefully someone could guide me in the right direction. I have a shared or static class in my website (App_Code folder) which has static methods to send emails asychronoulsy. So whenever there is an exception in any of my pages or classes I call these methods to send an email to support asynchronously. Now when there is an exception in a page, to route that exception asynchronously I need to have Async = "true" for that page. I have more than 50 pages and I don't want to set Async= "true" on every page as I read that it affects performance. So I was wondering if there is any way I could send emails asynchronously without having to set async = "true" on every page. Thanks for your time,   Uday.    

SMTP SENDMAIL corrupts some emails

  
At each month-end, we have several SQL 2000 jobs that mail that send out attached spreadsheets (local volume on the SQL server) to various recipients.  Recently, some of them started showing up unable to be opened.  The error messages usually allow you to click through, but the data is spread across a couple of worksheets and is not formatted properly. If the job is re-run, the attachment is sometimes delivered in a readable fashion, other times it is not. A separate test script that performs the same function seems to always deliver a usable spreadsheet attachment. We have no reason to believe it is the email or local virusscan (TrendMicro OfficeScan, TrendMicro ScanMail for Exchange), since we have appropriate exceptions in place. A search for relavent articles on "SMTP SENDMAIL CORRUPTION" doesn't turn up any obvious hits, so I don't think this is widespread or common. Anybody with some input? Thanks

Error on sending Outlook emails

  
Hi,I am trying to send an email using Outlook in my application. When I run the application in my local machine , it works fine and sends the email using my outlook address. But when I depolyed it onto our server, which is a  Windows Server 2008, it throws an error:Description:            Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.Date/ time:            20100908_03:51:48FullErrorOutput:            System.Runtime.InteropServices.COMException (0x80080005): Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.   at _Default.SendWelcomeEmails(String email)   at _Default.btnGrant_Command(Object sender, CommandEventArgs e)   at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)   at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)   at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)   a

SMTP SENDMAIL corrupts some emails

  
At each month-end, we have several SQL 2000 jobs that mail that send out attached spreadsheets (local volume on the SQL server) to various recipients.  Recently, some of them started showing up unable to be opened.  The error messages usually allow you to click through, but the data is spread across a couple of worksheets and is not formatted properly. If the job is re-run, the attachment is sometimes delivered in a readable fashion, other times it is not. A separate test script that performs the same function seems to always deliver a usable spreadsheet attachment. We have no reason to believe it is the email or local virusscan (TrendMicro OfficeScan, TrendMicro ScanMail for Exchange), since we have appropriate exceptions in place. A search for relavent articles on "SMTP SENDMAIL CORRUPTION" doesn't turn up any obvious hits, so I don't think this is widespread or common. Anybody with some input? Thanks

What will be the correct smtp settings for sending out email from an asp.net website to gmail's bus

  
Hi,I have setup a gmail's business account for my company.Now I want to receive all the emails like ContactUs, Qoute Email, etc from my website to that account i.e. info@mydomainname.com I have added the following smtp settings behind my web formsSmtpClient smtpClient = new SmtpClient("localhost",25); //Providing Network credentials smtpClient.Credentials = new System.Net.NetworkCredential("quote@mydomainname.com", "password"); smtpClient.UseDefaultCredentials = true; smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network; MailMessage mail = new MailMessage(); //HTML Mail Format mail.IsBodyHtml = false; //Setting Form , To and CC mail.From = new MailAddress("quote@mydomainname.com", "My Web Site"); mail.To.Add(new MailAddress("info@mydomainname.com")); This code gives me feedback "email has successful sent"  but it does not send any email to info@mydomainname.comCan anyone let me know what will be the correct smtp settings for sending out emails to gmail's business accounts?Regards,Dazy

Sending email via SmtpClient() not working with smtp.gmail.com :(

  
Help I cannot seem to send an email via my gmail account using "C#" why not?   <system.net> <mailSettings> <smtp deliveryMethod="Network" from="ian.coetzer@gmail.com"> <network host="smtp.gmail.com" port="587" enableSsl ="true" defaultCredentials ="false" password ="xxxxxx" userName ="ian.coetzer@gmail.com"></network> </smtp> </mailSettings> </system.net> SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try { message.To.Add(emailTo); message.Subject = ""; message.Body = GetEmailBody(userName, password, url); smtpClient.Send(message); return true; } catch(Exception ex) { throw new ApplicationException("Could not send notification.", ex); }   I.W Coetzer

sending bulk of emails

  

Hello guys

   I have a situation where i have to send around 50,000 emails with around 90kb attachment, each attachment will be generated by crystal reports then sent by email to the subscriber, what is the best practice for this? thanks alot


sending email using IIS smtp service

  

 I am working on an email that someone will send from one of our main sites requesting an account password.  I am using System.Net.Mail.MailMessage to create the email and then sending it using System.Net.Mail.SmtpClient.  Below is my code: 

	Public Function sendEmail(ByVal address As String) As String
		Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
		
		mailMessage.To.Add(New System.Net.Mail.MailAddress("emailAddress"))
		mailMessage.From = (New System.Net.Mail.MailAddress(address))
		
		Dim smtpClient As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient()
		
		Try
			smtpClient.Send(mailMessage)
		Catch ex As Exception
			Throw New ApplicationException("Data Error", ex)
		End Try
	End Function

	Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
		sendEmail("emailAddress")
	End Sub


Then in my web.config file I have the following

		<mailSettings>
			<smtp>
				<network host="cook.CMAP.public" port="25" 
					defaultCredentials="true"/>
			</smtp>
		</mailSettings>
It all looks like it is right bu

Can't send SMTP to all emails

  

Hi, I can send email with my asp.net 2.0 to gmail and other domains with my local SMTP server, but if I try and send it to a cellphone like 5551234567@tmomail.net, the mail just gets stuck in the SMTP queue.  I can send a text message via email to that same email address with normal email.  For example, I can send an email through gmail or my company's server to the tmomail.net email, but I can't from my local SMTP server.  I can send email with my local SMTP server to other Internet and Intranet emails, just not the phone.  My local SMTP is working, security is for localhost only, just can't send to this address.

 Thanks for any help.


Sending Digitally Signed emails using C#

  
Hi All,

    I have a requirement of sending a digitally signed email using C#,ASP.net. I tried it several ways and atlast using ASPEmail and ASPEncrypt i was able to access certificate but iam getting the mail address as the name of the certificate holder. Iam unable to find how to read the email address from the certificate. Any support will be appreciated. Thanks in advance.
phani kumar ---help me out

Workflow keep sending emails!

  

Hi,

i customized a workflow using SPD and attach it with a List, the trigger was when a specific item field changed, send an email.

the problem is the workflow keep sending the emails repeatedly . i deleted the list item, i even deleted the workflow itself from the Settings >> Workflow settings, i cleared the SPD workflow cashe, and it still sending the emails!

appreciate your help..


smtp sending email twice.

  

I am using .net membership functionality, The problem is on forget password page it send two emails to the user , any idea why?

I am using Windows 2008 Server.

Imports System.Net.Mail

Partial Class registration_ForgotPassword
    Inherits System.Web.UI.Page
    Protected Sub btnSendPassword_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSendPassword.Click
        SendForgotPasswordEmail()
    End Sub

#Region "SendForgotPasswordEmail"
    Private Sub SendForgotPasswordEmail()
        Dim emailFrom As String = ConfigurationManager.AppSettings("EmailFrom").ToString()

        Dim message As String = String.Empty
        Dim emailTo As String = txtEmail.Text

        Dim username As String
        Dim password As String
        password = ""

        Dim list As MembershipUserCollection
        list = Membership.FindUsersByEmail(emailTo)

        If list.Count > 0 Then
            username = Membership.GetUserNameByEmail(emailTo)
            password = list(username).ResetPassword()

            Dim msg As String = ""
            msg = "Your password is " + password

            msg = msg & "</br> As this is a temporary password please immediately change your password after login."
            message = msg
            Dim objmm As New MailMessag

Emails in SMTP

  

Hi All,

My program sends emails via SMTP, it sends emails with no problem when just a normal email address ie me@hotmail.com but as soon as I try to send it to a pre defined distribution list i get a bounce back message in outlook telling me I dont have permission to send to this list.

I have put in my network credentials into the code but it doesn't seem to make a difference.

Does anyone know if there is any other reason it wont send to a distribution list? The distrbution list was created in Active Directory, it is not a list I have setup in my own outlook.

Any thoughts appreciated.

Thanks


Sending Emails

  

Hi all.


I'm trying to solve a problem about sending emails from a contact form.  I have the first script that i'm using it sending but only to my external account and I got this on that sends but i'ts in vb and I'm not able to attach a style sheet to it. could any one tell me a code that I can use to replace the VB version.  Or. can translate the VB into C#


This will be appreciated.

PHP

this is my web config file
<system.net>
		<mailSettings>
			<smtp from="send@myservices.com" deliveryMethod="Network">
				<network host="mail.myservice.com" port="25" userName="send@myservices.com" password="service" />
			</smtp>
		</mailSettings>
	</system.net>
</configuration>


this is my C# backend code.

  protected void Button1_Click(object sender, EventArgs e)
        {
            SmtpClient smtpClient = new SmtpClient(); MailMessage message = new MailMessage(); try
            {
                MailAddress fromAddress = new MailAddress(Email.Text.ToString(), this.Contname.Text.ToString());
                message.From = fromAddress;//here you can set address   
                message.To.Add("contact@services.com"

Sending emails to user from people picker - non-exchange user

  

Hi all another issue @ hand, our production environment is in co-existence between exchange and domino, mail flow is working fine between them as we do directory sync. now for the juicy part, when sending email notification from sharepoint, it users people picker to pick up users synced from AD. To Exchange users it goes through without issue, but to Domino users it does not, even though the AD account has the email field in account been tabulated. For Domino users we have AD account and Mail contact for mail fow. Can someone help me understand why is it so when even with the email field been tabulated in the AD accoutn for the Domino users, email notification does not go through, but when the email address of the users is hard-coded into the notification the email goes through.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend