Sponsored by
www.aspnetemail.com
|
 |
Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
-
Does it supports Cc and Bcc list
[ Reply ]
Does System.Web.Mail in .NET supports Cc and Bcc receipients? If yes, would anyone show me a simple code of how to do it?
Thanks in advance.
Alvin Ong [ alvino ( at ) sunway dot com dot my ],
2004-04-29 01:22:10
#
-
RE: Does it supports Cc and Bcc list
[ Reply ]
Yes, you can use Cc and Bcc when building a mail message. To add on to the authors example, use:
-------------------- Dim mail As New MailMessage() mail.To = "me@mycompany.com;him@hiscompany.com;her@hercompany.com" mail.Cc = "them@company.com" mail.Bcc = "blind@company.com" mail.From = "you@yourcompany.com" mail.Subject = "this is a test email." mail.Body = "this is my test email body." SmtpMail.SmtpServer = "localhost" 'your real server goes here SmtpMail.Send(mail) --------------------
All members can be found in the Framework SDK 1.1 under: ms-help://MS.NETFrameworkSDKv1.1/cpref/html/frlrfsystemwebmailmailmessagememberstopic.htm
NBB [ development ( at ) oraclethree dot com ],
2005-03-15 12:59:14
#
-
RE RE: Does it supports Cc and Bcc list
[ Reply ]
If u figure it out, I would appreciate it if u would email me and let me know. So far, I can't figure it out.
Thanx,
Ken Fitzgerald
Ken [ kscottfitzgerald ( at ) gmail dot com ],
2008-04-16 21:05:49
#
-
Multiple recipients error scenario
[ Reply ]
Recently using System.Web.Mail with multiple recipients - I noticed that if one of the recipients was invalid - the entire mail is not sent.
Any way around this?
Joe [ silver_joe ( at ) hotmail dot com ],
2004-09-23 10:44:52
#
-
Is sending to multiple recipients limited?
[ Reply ]
Can I send e-mail five or more recipients? If yes, how can I, please?
Martin Opálka [ opalka ( at ) access-it dot cz ],
2004-12-09 07:16:42
#
-
Getting a email list from a table and sending.
[ Reply ]
How can I retrieve a list of emails from a table and send a pernsonalized email?
I'm trying with datalist, but with no sucess.
Tkx in advance, Hidd
Rafael Hidd [ rafahidd ( at ) terra dot com dot br ],
2005-05-10 22:04:34
#
-
RE: Getting a email list from a table and sending.
[ Reply ]
Here's a code snippet in VB.NET. You'll need to change your data libraries / classes / etc. as appropriate, I'll be using SQLClient.
For SQL Server Stored Procedure:
CREATE PROCEDURE spGetAddresses AS SELECT emailaddress FROM tblpeople GO
ASP.NET page code snippet:
Dim strAddys As String Dim objConn As New SqlConnection("YOURCONNECTIONSTRING") Dim objCmd As New SqlCommand("spGetAddresses", objConn) objCmd.CommandType = CommandType.StoredProcedure Dim objReader As SqlDataReader
objConn.Open() objReader = objCmd.ExecuteReader() While objReader.Read() strAddys += objReader("emailaddress") & ";" End While objConn.Close() objCmd.Dispose() objConn.Dispose()
Dim objMail As New MailMessage() With objMail .To = "you@yourserver.com" ' some dummy address to display to all users .From = "me@myserver.com" .Bcc = strAddys ' hides addresses from each other .Subject = "Here is a message" .Body = "Hello World!" End With
SmtpMail.SmtpServer = "YOURMAILSERVER" SmtpMail.Send(objMail)
Doug Vanderweide [ i_hates_spam ( at ) yahoo dot com ],
2005-06-30 12:02:40
#
-
RE: Getting a email list from a table and sending.
[ Reply ]
using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.SqlClient; using System.Net.Mail;
public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { }
protected void sendbtn_Click(object sender, EventArgs e) { SqlConnection cn = new SqlConnection("user id=scott;password=tiger;data source=svr;database=master"); SqlCommand cmd = new SqlCommand("select EMail from Emails", cn); cn.Open();
SqlDataReader dr; dr = cmd.ExecuteReader(); SmtpClient smtp = new SmtpClient(); smtp.Host = "host name"; smtp.Port = port number;
MailMessage m = new MailMessage(); m.From = new MailAddress(txtFrom.Text.Trim()); while (dr.Read()) {
m.To.Add(new MailAddress(dr[0].ToString()));
} dr.Close(); m.Subject = txtSubject.Text.Trim(); m.Body = txtBody.Text.Trim(); smtp.Send(m); lblmsg.Text = "Your message was successfully sent"; } }
joohitha [ bannu_nitw ( at ) yahoo dot co dot in ],
2008-03-03 07:04:24
#
-
email + recipient
[ Reply ]
if i want to assign a new recipient and i don't want hard code in the program. how to do that? My idea is use sqlcommand to select email and assign a variable. so, i mail to variable. my idea can work in email? please share your opinion at here.
william [ wai221 ( at ) yahoo dot com ],
2005-08-22 19:51:31
#
-
RE: email + recipient
[ Reply ]
Dim sqlSelect1 As New SqlCommand("Select Email from Employee where Employee_ID = '" & txtID.text & "'", SqlConnection1) Dim mailFrom As MailFormat SqlConnection1.Open() mailFrom = sqlSelect1.ExecuteNonQuery SqlConnection1.Close()
Dim mail As New MailMessage mail.To = mailFrom mail.From = "abc@yahoo.com" mail.Subject = "this is a test email." mail.BodyFormat = MailFormat.Html mail.Body = "<hr><b>Employee Details:</b> <p>" & "<br>Employee ID:" & txtID.Text & "<br>Employee Name:" & txtName.Text
SmtpMail.SmtpServer = "192.168.31.127" 'your real server goes here SmtpMail.Send(mail)
william [ test ( at ) test dot com ],
2005-08-22 19:54:43
#
-
troubleshooting
[ Reply ]
when addressing multiple recipients,i noticed that if one of the recipients is invalid,then nobody gets the message?how can i overcome this problem?
sumesh [ i_hates_spam ( at ) yahoo dot com ],
2005-11-23 01:25:04
#
-
How to send an attachment to remote server in asp.net 2003 like yahoo,rediff etc
[ Reply ]
I have seen so many websites to send an attachment but i can't find how to send an attachment to the remote server ie like yahoo,rediff etc.
jagadeesh [ jagadeeshb_mca ( at ) yahoo dot co dot in ],
2006-03-21 13:09:54
#
-
RE: How to send an attachment to remote server in asp.net 2003 like yahoo,rediff etc
[ Reply ]
MailMessage mail = new MailMessage(); mail.From = txtFrom.Text; mail.To = txtTo.Text; mail.Subject = txtSubject.Text; mail.Body = txtMsg.Text; mail.BodyFormat = MailFormat.Html; mail.Cc=txtCc.Text; string path=Server.MapPath("./"); //string strdir = "D:\\temp\\";
string strfilename = Path.GetFileName(txtFile.PostedFile.FileName);
txtFile.PostedFile.SaveAs(path+strfilename);
mail.Attachments.Add(new MailAttachment(path+strfilename));
try { SmtpMail.Send(mail); } catch(Exception ex) { Response.Write("<b>Exception Occured:</b> " +ex); } finally { Response.Write("Your E-mail has been sent sucessfully"); } using System.IO using system.web.mail import these two
bhushan [ srp_bhushan ( at ) hotmail dot com ],
2006-05-08 00:53:26
#
-
email id separator
[ Reply ]
can email id separator be any charater or can only be semicolon?
if any character is allowed as separator then how and where to speicify that?
Ganesh M [ ramco dot ganesh ( at ) gmail dot com ],
2006-06-12 01:50:59
#
-
Sending and Receiving Email using Asp.net
[ Reply ]
Please send me a sample program on how to receive and send email in asp.net 2005.
Noel Samson [ noel241977 ( at ) yahoo dot com ],
2006-09-12 20:08:59
#
-
Multiple recipients
[ Reply ]
If i would like to post two email addresses from a form variable. how can i specify that in the code... normal way is mail.to = "first address;second address' if it is from a form variable mail.to = "request.form("email1");request.form("email2")" it wont work, giving me some error msges, im a newbee.. please help me to sort out this issue
Vijay [ vijayan ( at ) h4nholdings dot com ],
2006-09-24 04:19:42
#
-
RE: Multiple recipients
[ Reply ]
Separate multiple email addesses with commas, e.g. one@mydomain.com,two@mydomain.com,three@mydomain.com
Here is the C# line I use to grab the addresses from the web.config file:
mail.To.Add(ConfigurationManager.AppSettings.Get("SupportEmail_To"));
Take care.
Troy
Troy Scheffel [ tscheffel ( at ) woodmarktech dot com ],
2007-09-17 09:15:53
#
-
Maximum Recipients Allowed
[ Reply ]
Is there a max on the number of recipients allowed in the multiple recipient format?
BJ [ bjstuh20 ( at ) hotmail dot com ],
2006-10-17 14:44:56
#
-
Wrong info about multiple recepient
[ Reply ]
This tutorial redirects users to use ";" (semicolon) and that doesn't work for specifying multiple recepients and gives error, if you use "," (comma), problem goes away.
Please correct this info, if this works for you.
Let me know
Thanks.
kimiraikkonen [ kimiraikkonen85 ( at ) hotmail dot com ],
2007-11-20 09:40:00
#
-
RE: Wrong info about multiple recepient
[ Reply ]
I seperated the email addresses with a comma, however now only the first address in the field actually receives the message
Henry [ hfactor9 ( at ) aol dot com ],
2008-03-26 00:27:08
#
-
RE: Wrong info about multiple recepient
[ Reply ]
You are right ! comma works, semicolon does not.
Dan [ dan dot erez ( at ) gmail dot com ],
2008-05-02 06:57:24
#
-
RE RE: Wrong info about multiple recepient
[ Reply ]
It looks like Yahoo email supports both comma and semi-colon to separate email addresses. I tested and both worked. However, I am not sure if both would work on GMAIL or Hotmail. Let us know your experience with these... thanks!
Henry [ humingqi ( at ) yahoo dot com ],
2008-06-10 11:33:00
#
-
outgoing mail server
[ Reply ]
How to get the From address value of the outgoing mail server through code ?
Sangita [ susangita dot moharana ( at ) gmail dot com ],
2008-05-16 02:32:08
#
|