i've got a another question not regarding to this subject..but its a simple one i guess so please help..
my question is,when the user submit a ticket,we actually allow the user to choose a due date for that particular ticket they have submitted.but we have
a criteria which is : the due date they choose must be 3 days after the current date..
so for example,if the current date is 27 apr,the due date they choose should be 3 days after this which can be 1st of may..and also excluding the weekends..
you remember i posted something for you regarding the weekends checking as well? i think you can try to change it a bit and make it works
e.g. when user enter a new ticket info, and choose a date, and the user click a button to submit it. on the button click event, call the same function as what i hv wrote to you last time and i think it should work.
Protected Sub btn_Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Send.Click
Dim myMailMessage As New MailMessage
Dim mySmtpClient As New Mail.SmtpClient()
If txt_from.Text <> "" Then
myMailMessage.From = New MailAddress(txt_from.Text)
Else
myMailMessage.From = New MailAddress("Jane@stts.com.sg")
End If
If txt_to.Text <> "" Then
myMailMessage.To.Add(txt_to.Text)
Else
myMailMessage.To.Add("Zoey@stts.com.sg")
End If
If txt_cc.Text <> "" Then
myMailMessage.CC.Add(txt_cc.Text)
End If
so i tried sending this,but when i receive the email..it shows this : Delivery Status Notification (Failure)
Your message did not reach some or all of the intended recipients.
Subject:
Sent: 4/27/2009 10:17 AM
The following recipient(s) could not be reached:
Zoey on 4/27/2009 10:15 AM
The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system administrator.
< laotze.stee.com.sg #5.0.0 smtp; 5.1.0 - Unknown address error 550-'5.7.1 <Zoey@stts.com.sg>... Access denied' (delivery attempts: 0)>
MailMessage myMailMessage =
new
MailMessage();
SmtpClient mySmtpClient =
new
SmtpClient();
mySmtpClient.Host =
"XXXXX";
//your own smtp server name
myMailMessage.From = new
MailAddress("myemail");
//your own email addressmyMailMessage.To.Add("myemail");
//your own smtp server name
mySmtpClient.Send(myMailMessage);
i suggest you to directly try to run this code by changing the host to ur host and both email to your own email and test whether it can send out email or not
btw delete your email address in your post if it is a real one - protect scam k
Protected Sub btn_Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Send.Click
Dim myMailMessage As New MailMessage
Dim mySmtpClient As New Mail.SmtpClient()
If txt_from.Text <> "" Then
myMailMessage.From = New MailAddress(txt_from.Text)
Else
myMailMessage.From = New MailAddress("Zoey@stts.com.sg")
End If
If txt_to.Text <> "" Then
myMailMessage.To.Add(txt_to.Text)
Else
myMailMessage.To.Add("Jane@stts.com.sg")
End If
If txt_cc.Text <> "" Then
myMailMessage.CC.Add(txt_cc.Text)
End If
mySmtpClient.Send(myMailMessage)
End Sub
If Page.IsPostBack = False Then
txt_smtpServer.Text = "61.8.252.35"
txt_from.Text = "Zoey@stts.com.sg"
txt_to.Text = "Jane@stts.com.sg"
txt_cc.Text = "Zoey@stts.com.sg"
End If
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 24, 2009 06:58 AM|LINK
regarding the sql agent, read this
http://forums.asp.net/p/1408339/3074678.aspx
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 24, 2009 07:18 AM|LINK
okay can..thanx!(:
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 27, 2009 01:21 AM|LINK
hey!
i've got a another question not regarding to this subject..but its a simple one i guess so please help..
my question is,when the user submit a ticket,we actually allow the user to choose a due date for that particular ticket they have submitted.but we have
a criteria which is : the due date they choose must be 3 days after the current date..
so for example,if the current date is 27 apr,the due date they choose should be 3 days after this which can be 1st of may..and also excluding the weekends..
how do i do this??
any idea??please help..
thanx!
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 27, 2009 01:48 AM|LINK
hi there,
you remember i posted something for you regarding the weekends checking as well? i think you can try to change it a bit and make it works
e.g. when user enter a new ticket info, and choose a date, and the user click a button to submit it. on the button click event, call the same function as what i hv wrote to you last time and i think it should work.
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 27, 2009 02:02 AM|LINK
oh okok..i shall go try that out..thanx for replying..!(:
shahed.kazi
All-Star
17953 Points
3635 Posts
Re: Sending of email!
Apr 27, 2009 03:10 AM|LINK
You will need to create a windows service that will run a schedule task to send email.
.NET World |Captcha Control
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 27, 2009 03:21 AM|LINK
hey ya..thx for replying..but i'm actually trying to code the email things in my email template..
i have these few lines of code :
behind my send button :
-----------------------------------------------------------------------
Protected Sub btn_Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Send.Click
Dim myMailMessage As New MailMessage
Dim mySmtpClient As New Mail.SmtpClient()
mySmtpClient.Host = txt_smtpServer.Text
mySmtpClient.Port = 25
mySmtpClient.UseDefaultCredentials = True
If txt_from.Text <> "" Then
myMailMessage.From = New MailAddress(txt_from.Text)
Else
myMailMessage.From = New MailAddress("Jane@stts.com.sg")
End If
If txt_to.Text <> "" Then
myMailMessage.To.Add(txt_to.Text)
Else
myMailMessage.To.Add("Zoey@stts.com.sg")
End If
If txt_cc.Text <> "" Then
myMailMessage.CC.Add(txt_cc.Text)
End If
mySmtpClient.Send(myMailMessage)
End Sub
----------------------------------------------------------------------------------------
so i tried sending this,but when i receive the email..it shows this : Delivery Status Notification (Failure)
Your message did not reach some or all of the intended recipients.
Subject:
Sent: 4/27/2009 10:17 AM
The following recipient(s) could not be reached:
Zoey on 4/27/2009 10:15 AM
The e-mail system was unable to deliver the message, but did not report a specific reason. Check the address and try again. If it still fails, contact your system administrator.
< laotze.stee.com.sg #5.0.0 smtp; 5.1.0 - Unknown address error 550-'5.7.1 <Zoey@stts.com.sg>... Access denied' (delivery attempts: 0)>
any idea y i got this??
mo meng
Contributor
6700 Points
1351 Posts
Re: Sending of email!
Apr 27, 2009 03:51 AM|LINK
mySmtpClient.Host =
"XXXXX"; //your own smtp server name myMailMessage.From = new MailAddress("myemail"); //your own email addressmyMailMessage.To.Add("myemail"); //your own smtp server namemySmtpClient.Send(myMailMessage);
i suggest you to directly try to run this code by changing the host to ur host and both email to your own email and test whether it can send out email or not
btw delete your email address in your post if it is a real one - protect scam k
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 27, 2009 04:28 AM|LINK
okay can..
anyway thx for the advice!! :D thats a fake one.. :P hehex..
i shall go try and come back aite.. :)
BabyAngel
Member
80 Points
226 Posts
Re: Sending of email!
Apr 27, 2009 05:14 AM|LINK
hey..i tried ready..but still the same delievery failure.. :(
this the code behind my send button;
------------------------------------------------------------------
Protected Sub btn_Send_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn_Send.Click
Dim myMailMessage As New MailMessage
Dim mySmtpClient As New Mail.SmtpClient()
mySmtpClient.Host = txt_smtpServer.Text
mySmtpClient.Port = 25
mySmtpClient.UseDefaultCredentials = True
If txt_from.Text <> "" Then
myMailMessage.From = New MailAddress(txt_from.Text)
Else
myMailMessage.From = New MailAddress("Zoey@stts.com.sg")
End If
If txt_to.Text <> "" Then
myMailMessage.To.Add(txt_to.Text)
Else
myMailMessage.To.Add("Jane@stts.com.sg")
End If
If txt_cc.Text <> "" Then
myMailMessage.CC.Add(txt_cc.Text)
End If
mySmtpClient.Send(myMailMessage)
End Sub
------------------------------------------------------------------------------
and there's some code i place at my page load.. :
-------------------------------------------------------------------------------
If Page.IsPostBack = False Then
txt_smtpServer.Text = "61.8.252.35"
txt_from.Text = "Zoey@stts.com.sg"
txt_to.Text = "Jane@stts.com.sg"
txt_cc.Text = "Zoey@stts.com.sg"
End If
-----------------------------------------------------------------------------------