Email Application

Joined
Apr 28, 2008
Messages
5
Programming Experience
1-3
What's wrong with this code?

Process.Start("Mailto:" + tb_To.Text & "?Cc=" + Tb_Cc.Text & "?Bcc=" + tb_Bcc.Text)


For some reason the bcc email address gets attach to the cc address.

Thanks!
 
The character in front of the Bcc should be an ampersand instead of a question mark.

VB.NET:
System.Diagnostics.Process.Start("MailTo:" & tb_To.Text & "cc=" & tb_Cc.Text & "&bcc=" & tb_Bcc.Text)
 
multiple emails

I know this is a pretty old thread but I didn't want to start a new one. I have not touched VB since 2001.

I'm using Visual Studio 2008 - Visual Basic

I have an email textbox call MAIN_EMAILTextBox
A command button call bt_To
Another text box that is call tb_To
Another command button call bt_SendAllMail


I click on the command button "bt_To" and that gets me the email address's within "MAIN_EMAILTextBox". I can click on "bt_To" as many times I want and it'll enter in whatever email that is currently in "MAIN_EMAILTextBox".

The command button "bt_To" inserts the data into tb_To.

Example data that could be in the text box "tb_To" This field can contain many emails.

to_1@test.com; to_2@test.com; to_3@test.com

I click on the command button "bt_SendAllMail" and it will open up the default mail client (this is outlook) and insert those emails in ready for them to type in the subject.

My problem is that I can get it to work if the data is like this -

to_1@test.com, to_2@test.com, to_3@test.com

The differences is a comma "," instead of a semi-colon ";" .

But outlook requires the email to be separated by semi-colons instead of commas.

Codes:
--------------------------------------------

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_To.Click

If TabControl1.SelectedIndex() = 0 Then
Dim MainEmail As String = tb_To.Text

If (tb_To.Text <> "") Then
tb_To.Text = MainEmail + ", " + MAIN_EMAILTextBox.Text
Else
tb_To.Text = MAIN_EMAILTextBox.Text
End If
End If


End Sub

--------------------------------------------

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_SendAllMail.Click

If tb_To.Text = "" Then
MsgBox("You must enter an email addresses.")
Exit Sub
End If

'If IsValidEmail(tb_To.Text) = False Then
'MsgBox("Please enter a valid To: email address.")
'Exit Sub
'End If

EmailMessage.From = New MailAddress(Environment.UserName + "@test.com")
EmailMessage.To.Add(tb_To.Text)

Process.Start("Mailto:" + tb_To.Text)

End Sub

-------------------------------------------------

Outlook only works if the emails are separated by a ";" and not a ",".

Help?

I know about MailAddressCollection but I am not sure on how to code it in.


Thanks!!!
 
MailTo protocol specifies comma as separator for multiple addresses. This works with Outlook since it will parse the text of the mailto url in accordance with the specification. When Outlook has finished parsing the command it will put multiple recipients into its To box separated with semicolons, because this is how Outlook do it. If this doesn't work for you something else must be the problem.
 
This works, I just had to go to "Tools-Options-Preferences-Emai Options-Advanced Email Options- check the checkbox in "Allow comma as address separator".

Thanks!
 
I didn't see that setting, it is also default.
 
Back
Top