locked
Sending confirmation email to the user and notification email to the manager RRS feed

  • Question

  • User-1682135303 posted
    I am creating an application in ASP.Net 2.0, the user can choose the service that he want and submit the request after choosing the form and filling the needed details the user should click on the submit button, then two emails should be sent; a confirmation email to the user him/herself and a notification email to his/her direct manager to get the approval on the requested ticket.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>How can I send the emails using VB language?<o:p></o:p>Can some one help me please?<o:p></o:p>

     

    Wednesday, May 20, 2009 10:18 AM

All replies

  • Wednesday, May 20, 2009 11:23 AM
  • User1330954201 posted
    Quick example using System.Net.Mail.MailMessage :-
    
    Using mm As New System.Net.Mail.MailMessage
                mm.Priority = MailPriority.High
    
                
                mm.To.Add(New MailAddress("destination@domain"))
    
                mm.From = New MailAddress("noreply@senderdomain")
    
                mm.Subject = "This is an example email subject"
    
                mm.Body = "This is an example email body"
    
                mm.IsBodyHtml = False
    
                Dim oSmtp As New SmtpClient
                oSmtp.Credentials = New Net.NetworkCredential("username", "password")
                oSmtp.Send(mm)
            End Using
     
    Wednesday, May 20, 2009 11:25 AM
  • User-1171043462 posted

    Download the code from here

    http://www.aspsnippets.com/post/2009/01/18/Send-Email-using-VBNet.aspx

    Wednesday, May 20, 2009 11:37 AM
  • User1330954201 posted

    Also the following in your config file :-

    1    <system.net>
    2    		<mailSettings>
    3    			<smtp>
    4    				<network host="192.168.1.666" port="25"/>
    5    			</smtp>
    6    		</mailSettings>
    7    	</system.net>
     Where network host represents the smtp server you want to use. This can also be set through code.
    I think if you leave this out it will try and send via the local smtp service on the box your code is running on.
    
     
    Wednesday, May 20, 2009 11:38 AM
  • User-1682135303 posted

    Hi,

    I wan to send the email from my application to a local folder in my machine

    How can I do this?

     

    Thursday, May 28, 2009 2:49 AM
  • User-1682135303 posted

    Can someone answer my question Please?

    Thursday, May 28, 2009 4:58 AM
  • User509596457 posted

    Your question doesn't make very much sense. Emails are sent from a mail server to an email address. Does this local folder on your machine have an email address? Why not just send the email to yourself (your own email address)?

    Thursday, May 28, 2009 8:31 AM
  • User-1682135303 posted

    I want to test sending email in my application so, instead of sending the email to my own email address I want the email to be sent to a folder in my machine. I want the emails to be saved in this folder.

    Is there a way to do this?

     

    Thursday, May 28, 2009 10:04 AM
  • User509596457 posted

    After you have composed your message, before you send it, change the smtp setting as follows: 

    smtpClient.PickupDirectoryLocation = "C:\\temp\\";
    smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
    smtpClient.Send(mail);

    Thursday, May 28, 2009 10:39 AM