Help with SmtpMail.Send

binici

Active member
Joined
Sep 11, 2006
Messages
26
Programming Experience
Beginner
Hello:
I need to send two seperate message one to the the client, who is actually CC and another message that is sent to their broker, but with limited information. Its basically a confirmation message (registration application online) that the client fills out.
I have this so far...
VB.NET:
If strBrokerEmail = "" Then
            Dim Mail As New MailMessage
            'Mail.To = "[EMAIL="MemberApplication@pwr.net"]MemberApplication@pwr.net[/EMAIL]"
            Mail.To = "[EMAIL="roberta@pwr.net"]roberta@pwr.net[/EMAIL]"
            'Mail.Cc = home_email.Text & ";" & strBrokerEmail
            Mail.Cc = home_email.Text
            Mail.From = """PWAOR Membership"" <[EMAIL="MemberApplication@pwr.net"]MemberApplication@pwr.net[/EMAIL]>"
            Mail.Subject = "New Member Application - " & member_first_name.Text & " " & member_middle_initial.Text & " " & member_last_name.Text
            Mail.BodyFormat = MailFormat.Html
            Mail.Body = "info.........................."
[I][B]The top portion only sends it to the client and membership if the client doesnt choose to cc their broker[/B][/I] 
else
           Dim Mail As New MailMessage
            'Mail.To = "[EMAIL="MemberApplication@pwr.net"]MemberApplication@pwr.net[/EMAIL]"
            Mail.To = "[EMAIL="roberta@pwr.net"]roberta@pwr.net[/EMAIL]"
            'Mail.Cc = home_email.Text & ";" & strBrokerEmail
            Mail.Cc = home_email.Text
            Mail.From = """PWAOR Membership"" <[EMAIL="MemberApplication@pwr.net"]MemberApplication@pwr.net[/EMAIL]>"
            Mail.Subject = "New Member Application - " & member_first_name.Text & " " & member_middle_initial.Text & " " & member_last_name.Text
            Mail.BodyFormat = MailFormat.Html
            Mail.Body = "info.........................."
[I]Now how or what do I add so it also sends to their broker, but a different Mail.Body information?[/I]
Sorta confused, I tried creating a new instance of MailMessage using a different variable name, but when I tested it the "Broker E-mail" recieves a "False", but the client and membership receives it.
Thank for all the help!
 
when I tested it the "Broker E-mail" receives a "False", but the client and membership receives it.
Not sure what you mean by that.

Did you notice that the code following 'If strBrokerEmail = "" Then' and 'else' are exactly the same. Wouldn't you then expect the same exact thing to happen for each case?

You can reuse the variable if you send the first one before reusing: create the first MailMessage, set its properties and send it, then change it's properties (Body, To, CC, ...) and send it.
 
Back
Top