I have a service account and when a Button us clicked it should be sent out from the service account. How should I set this out. The FroEmailAddress should be the service account
Thanks all, I sent the emails out when I use my Credentials. I wanted to use one of our Service account and the emails werent delivered. By Setting in SMTP in web,config in the network node ,as Username="Service account which is from address" Password="serviceaccoutn
password" and it worked
Ramu Ajay
Member
623 Points
203 Posts
Emails
Feb 25, 2013 10:20 PM|LINK
thirumaran00...
Star
8192 Points
1722 Posts
Re: Emails
Feb 25, 2013 10:30 PM|LINK
just want to make sure that, you are asking how to send email from asp.net ?
if yes someone answered already in asp.net
http://forums.asp.net/t/971802.aspx
With Friendly,
Thirumaran
krishnada25
Member
631 Points
906 Posts
Re: Emails
Feb 25, 2013 10:41 PM|LINK
Hi,
You Just write a function and inside the Email Functionality
Include Mailmessage.from = "ServiceaccountEmail"
Thanks,
Kris
Mandeep Joon
Participant
1570 Points
382 Posts
Re: Emails
Feb 26, 2013 02:59 AM|LINK
Hi,
MailMessage mail = new MailMessage(); mail.From = new MailAddress("demo@gmail.com"); mail.To.Add("yourmail@domain.com"); //to send mail on textbox value use this code. mail.To.Add(TextBox2.Text); mail.IsBodyHtml = true; mail.Subject = "Form"; mail.Body = "<br><br>Someone want to contact you <br>" + "<b>Name:</b>" + TextBox1.Text + " <br/> <b>Email :</b>" + TextBox2.Text + "; SmtpClient smtp = new SmtpClient("smtp.gmail.com",587); smtp.Credentials = new System.Net.NetworkCredential("demo@gmail.com", "password_here"); smtp.EnableSsl = true; smtp.Send(mail);Mandeep Joon
Blog:- Hightechnology.
prabu.raveen...
Contributor
5020 Points
955 Posts
Re: Emails
Feb 26, 2013 03:06 AM|LINK
You can use web.config file to set from email address and the use this setting while sending mails. For more details refer the below links,
http://www.geekcamp.us/articles/sending_email_in_aspnet_smtp_web_config.aspx
http://forums.asp.net/t/1768824.aspx/1
http://productforums.google.com/forum/#!topic/apps/fg5RNrQhdFY
vinay13mar
Star
7756 Points
1626 Posts
Re: Emails
Feb 26, 2013 03:34 AM|LINK
You needed to put account email in in From email id.
have a look of this tutorial
http://www.dotnetpools.com/Article/ArticleDetiail/?articleId=89&title=How-To-Sent-Mail-More-Than-One-Email-Id-One-Click-Event
V.K.Singh
Sujeet Saste
Contributor
3008 Points
572 Posts
Re: Emails
Feb 26, 2013 06:05 AM|LINK
You need to set all the things like FromEmail, HostName, PortNo, Password etc.
For more clarification, see my post in below thread :
http://forums.asp.net/t/1863908.aspx/1?HTML+Email+using+C+in+asp+net
Feel free to ask if any query remains.
Do FEAR (Face Everything And Rise)
Please mark as Answer if my post helps you..!
My Blog
raghavendra ...
Participant
1890 Points
435 Posts
Re: Emails
Feb 26, 2013 06:09 AM|LINK
Just include this namespace
and in the button click event try this code
protected void btnSubmit_Click(object sender, EventArgs e) { try { MailMessage message = new MailMessage(txtFrom.Text, txtTo.Text, txtSubject.Text, txtBody.Text); SmtpClient emailClient = new SmtpClient(txtSMTPServer.Text); emailClient.Send(message); LblMsgStatus.Text = "Message Sent"; } catch (Exception ex) { LblMsgStatus.Text=ex.ToString(); } }Ramu Ajay
Member
623 Points
203 Posts
Re: Emails
Feb 26, 2013 09:42 PM|LINK