I am using the SmtpClient in C# and I will be sending to potentially 1000s of email addresses.
I want to only the recipient's email address is displayed.
for example:
I send email to aa#xx.xx,bb#xx.xx,cc#xx.xx,dd#xx.xx...
aa can only see the email address aa#xx.xx,bb can only see the email address bb#xx.xx.
they don't know I send the email to others.
Use mail.BCC instead of mail.To for users who's addresses you dont't want to display to others
Related
I have this help desk application which sends an e-mail to me with a specific issue. The user is required to input his e-mail address into a textbox. What I'd like to do is for the user to get a copy of the problem as well.
MailMessage req_mail = new MailMessage(reqMail.Text, "system.admin#home.com");
Where reqMail.Text is the user's e-mail address.
Any ideas why it doesn't work? Because I can see from who it is...
The overload of the MailMessage constructor you're using takes a from and a to address.
You've supplied the users email as the from and your email as to. AFAIK, there isn't a constructor for CC'ing or BCC'ing.
Instead you just need to do this:
req_mail.Bcc.Add(new MailAddress(reqMail.Text));
Or:
req_mail.CC.Add(new MailAddress(reqMail.Text));
If you prefer.
According to the constructor you're using that MailMessage is from the user, not to the user. If you want to send the message to the user then their address would need to be in the To or CC or BCC parts of the message. Something like:
var req_mail = new MailMessage(reqMail.Text, "system.admin#home.com");
req_mail.CC.Add(new MailAddress(reqMail.Text));
I need to implement a “email support” section in our application. So email “To” address will be admin#mydomain.com” and from address will be the email address of the end user.(The end users email address may be on the same domain or another domain like user#mydomain.com or user#gmail.com).
In the application I am authenticated the email using admins account details (username and password)
System.Net.NetworkCredential("admin#mydomain.com", adminpassword);
Also I am using host address as “mail.mydomain.com”
Issue is I am getting the following error:
“Mailbox unavailable. The server response was: From address must
match authenticated address” error message.
Is it possible to send an email with the correct sender email address(users from address)
My code sample is
message.To.Add(“admin#mydomain.com”);
message.From = new MailAddress(“test#gmail.com”);
message.IsBodyHtml = true;
message.BodyEncoding = Encoding.UTF8;
var smtp = new SmtpClient("mail.mydomain.com");
smtp.Credentials = new System.Net.NetworkCredential(admin#mydomain.com, adminpassword);
smtp.EnableSsl = false;
object usrtkn = message;
smtp.Send(message);
In general the From address shouldn't be the user themselves, it should be an internal system address. This is mainly because the user isn't actually sending the email, the application is. In the email itself you can specify which user sent it (and what their email address is). You can perhaps even specify the user's email address in the ReplyTo field of the message.
But the message you're getting from the SMTP server pretty much says it all. If the message is "from" that user then the SMTP server refuses it because it's sensitive to authentication and origination of emails. To the SMTP server (to any SMTP server I would imagine) it looks like you're trying to spoof messages.
You cannot do what you are doing, because the SMTP server is not allowing you to "impersonate" the user's email address for sending to the system. And thank goodness this is the case or else people would be spamming/spoofing the heck out of everyone under someone else's name.
Why are you trying to have it appear that the user is sending an email to the application? Why not just have a support section of your application where users can "submit" requests for support to the system and then if you want to send emails out to the users, then your scenario will work, but just in reverse (where the system is the From address and the user is the To address).
I use Golang, I skill put the "From" int othe message
msg := []byte(
"From: root#myserver.com.br\r\n" +
"To: destiny#myserver.com\r\n" +
"cc: destiny2#myservercom\r\n" +
"Subject: Why are you not using Mailtrap yet?\r\n"+
"\r\n"+
"Here’s the space for our great sales pitch\r\n")
auth := smtp.PlainAuth("", root, password, host)
err := smtp.SendMail(address, auth, root, destinationEmail, msg)
SendGrid has the capability to send to multiple recipients with one call to its SMTP API by adding 'To' recipients in X-SMTPAPI Header : http://sendgrid.com/docs/API_Reference/SMTP_API/index.html.
You can customize the body of the email for each recipient using substitutions:
http://sendgrid.com/docs/API_Reference/SMTP_API/substitution_tags.html
But I can't find a way to send customized CC and BCC for each recipient.
I want to send different CC and BCC addresses for each email. How to do that?
Thanks...
There is no way to customize a CC or BCC through the X-SMTPAPI header on a per message basis. You could however, assign a BCC or CC that would apply to all the emails you're sending.
So for example, if you're sending out something that looks like this:
"x-SMTPAPI": {
"to": ["user1#example.com", "user2#example.com", ...],
"bcc": ["some.employee1#example.com", "some.employee2#example.com"],
...
}
Both user1#example.com and user2#example.com would receive emails and some.employee1#example.com and some.employee2#example.com would be BCC'ed on both emails that went out.
In the EWS, I found that in a saved draft EmailMessage m, people could use m.DisplayTo to get receipt's name, but no property to display email address. Then how and where can I get the receipt's email address and ccRecipt's email address, assume that recipt and ccRecipt are not null in the draft.
Use the ToRecipients and CCRecipients properties. They are collection of EmailAddress instances.
I am writing a program that polls an incoming mailbox (to which anyone who knows about it can post), reformats the info, then forwards the mail on to the correct address according to a predefined convention. For example, the incoming mail has:
From = "anybody#somedomain.com"
To = "myincomingmailbox#mydomain.com"
Subject = "Subject"
Body = "recipient#anotherdomain.com+newline+Body"
Then I take that email, preserve the "From" and "Subject" fields, but I change the "To" address to recipient#anotherdomain.com, and format the rest of the body according to my template.
Thus far all OK - but I anticipate a problem with spam filters on the recipient domains, since they may react as if I'm spoofing the "From" address.
What is the correct way to preserve the headers from the original mail intact, such that all the SPF/DKIM headers remain on the outgoing email, and the recipient domains don't treat the incoming mail as possible spam/phishing mails?