Given Email display name not updated in outlook - c#

I want to change my email display name which is sent by my MVC application.
actually, the email address is: sample#company.com
the default display name is: Company Sample.
Now i want to change that display name into "SomeOne" but it not works. i have tried below items,
Tried Email display name property:
MailAddress from = new MailAddress("sample#company.com", "SomeOne");
It works fine in Gmail but in outlook, the display name not changed.
MailAddress from = new MailAddress("sample#company.com", "\\SomeOne\\");
It will change the display name in outlook but double quote(") added at the last like this
SomeOne"
objMail.From = new MailAddress("<DisplayName>EmailAddress#domain.com");
Not works.
Can you please provide any suggestions..?
Thanks,
Nagaraj M

Your first address is correct
MailAddress from = new MailAddress("sample#company.com", "SomeOne");
And I believe the third is backwards
//objMail.From = new MailAddress("<DisplayName>EmailAddress#domain.com");
objMail.From = new MailAddress("DisplayName<EmailAddress#domain.com>");
Outlook presents other challenges. If the address is in your Outlook contacts it may overwrite the friendly address coming in. Same if you are sending from Outlook to a previous friendly address. In most cases clearing out the Most Recently Used (MRU) cache will take care of it. There are a few ways of doing this, some require working with the registry to find the location of the actual file
Clearing Outlook Most Recently Used Lists
your first address is correc

Related

wpf, send mail, let the user select the from field

I'm trying to launch the email app from the user click some hyper link, I want to add also attachment, the only thing that worked was this link
enter link description here, but now I don't want to specify the MailMessage.From field, I want it to be like when you click on mailto: link, it opens your deafault account or ask you to login, etc.., but whenever I try to set the mailMessage.From = new MailAddress("");, it throws exception, it should be an email
to get my app launch the mail with attachment, now how can I remove the field "From" and let the user use his mail or something like when you use mailto:
if I remove this line, it throws exception
mailMessage.From = new MailAddress();
If you want your WPF application to send an e-mail directly you should use the SmtpClient Class MSDN.
If you are trying to launch the default mail app (like outlook) to send the e-mail, I'd use Process.Start as one of the answers to the question linked specified.
var url = "mailto:user#domain.com";
// var url = "mailto:?subject=aSubject&body=aBody";
// var url = "mailto:?subject=aSubject&body=aBody&attachment=aFile";
Process.Start(url);

Sending Lotus Notes email through C# hiding SentBy field

I have developed code,in C#, which sends email in Lotus Notes.
I want SentBy(From field) in the email to be hidden. I have user the Principal field to make Custom field.
NotesDocument doc = db.CreateDocument();
doc.ReplaceItemValue("Form", "Memo");
doc.ReplaceItemValue("SendTo", richTextBox1.Text.Trim().Split(','));
doc.ReplaceItemValue("Subject", richTextBox3.Text);
doc.ReplaceItemValue("Principal", "Test Demo");
NotesRichTextItem _richTextItem = doc.CreateRichTextItem("Body");
_richTextItem.AppendText(richTextBox4.Text + "\r\n");
doc.SaveMessageOnSend = true;
if (this.check)
doc.Send(false);
MessageBox.Show("Mail Sent successfully");
The above code sends email perfectly but it doesn't hide the SentBy (From field). Sent By ( From field) always shows the name of the person running this code along with the Principal. Can this be hidden so that only the Principal field, here Test Demo, is only visible.
It can't be hidden if you're using the NotesDocument.Send() method. (IBM Domino is an enterprise email system, so it doesn't make spoofing senders easy.)
It can be hidden if you write the message directly to the Domino server's mail.box file. That's not supported by IBM, though, so if you do that you're on your own if you do anything that screws up email routing and delivery. You can find a link to sample code that does it, though, in one of the answers to this older question.

The specified string is not in the form required for an e-mail address. with valid address

I am developing a software which send email after the user pressed a button.
I encounter some issues with these emails: they sometimes raise this exception: The specified string is not in the form required for an e-mail address.. I emphasise on sometimes because they actually works sometimes.
Surprising thing is that the mail addresses are actually correctly formatted: they all look like blahblah#domain.com or Blah Blah <blahblah#domain.com>. This even happens with some of my company's mails, which - of course - are valid. I even checked all the addresses with this regex and they all passed: ^\w+([-+.']\w+)*#\w+([-.]\w+)*\.\w+([-.]\w+)*$.
Here are the steps my software is going through:
Add the main address:
var mail = new MailMessage(new MailAddress("logistics#company.com", "company logistics department"), new MailAddress(address));
Here the address is valid since the software did send an email to this address prior to this step.
In a loop I add the CCs addresses:
mail.CC.Add(new MailAddress(email));
Here I applied a null/empty check so I am not adding any empty mail address.
And finally I add myself in BCC address:
mail.Bcc.Add("my#company.com");
Is there any issue in the way I'm doing this ?
Are there some known issues (additionnaly random ones) about the C# .NET mail class?
Is there a limit on the maximum amount of To / CC / Bcc addresses this class can handle ?
EDIT: i'm using System.Net.Mail classes

Exchange API incorrect Subject

When ever I create a meeting in Outlook, Subject field for an appointment is going through incorrectly. Instead of something like "Test" I get the name of the user who created an appointment.
-> bold = title, admin = creator name
-> admin = creator name even though it suppose to be subject.
foreach (Appointment a in room.appointments)
m.Subject = a.Subject
Is this a known issue; Is there another field that is responsible for subject?
This is actually not an "issue" but a "feature" of Exchange's workflow for meeting invites. The default on a room resource is to replace the subject with the orgranizer. This can be changed for a room with a PowerShell command:
Set-Calendarprocessing -Identity:roommb -AddOrganizerToSubject:$false -DeleteSubject:$false
Of course you need proper permissions to do this, or else bribe your Exchange admin!

EWS API get Sender name when Cc information is missing

In work we have service mailbox and suddenly started coming mails with attachement daily, no one know why and how to stop that and nobody need that.
So im writing deleting script and i dont know how to detect/find these emails, because Cc field is blank and email with same Subject from same email address is already coming but difference is between alias, how can i read information from the image ?
I need declare a SearchFilter like
SearchFilter subjectFilter =
new SearchFilter.ContainsSubstring(ItemSchema.?WHATHERE?, "JOBRUN <something#company.com>");
Thank you :-)
If I do understand you correctly, and based on your screenshot, you want to get those emails that have the string JOBRUN in their Display Name (not in their Subject as your variable name states).
Altough I'm not sure if the following does the filtering based on the email-address of the sender only or additionally based on the sender's displayname (the documentation is pretty poor...), you could try the following:
var filter = new SearchFilter.ContainsSubstring(EmailMessageSchema.Sender, "JOBRUN");

Categories