Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send Email using SMTP

Status
Not open for further replies.

swetham

Programmer
May 5, 2010
257
DE
I need to send email using smtp server and the to addresses are of different mail servers. how can we send email to different mail servers?

Thanks,
Swetha.
 
I would think it's just a matter of setting the SmtpServer to the proper setting.
Code:
SmtpMail.SmtpServer = "mail.servername.com"
or maybe
Code:
SmtpMail.SmtpServer = "127.0.0.1"
I'm sure the experts here will be able to tell you if this is correct. You will of course need the proper permissions to send mail on the selected server.

Auguy
Sylvania/Toledo Ohio
 

You should be able to just make a list of the addresses, separated by a semicolon (;), like so:

Dim AddressList As String = ""

AddressLIst = "some.name@address1.com;some.other.name@address2.org;yet.another.name@someotherserver.net"



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Sorry, I misread the post, thought you were asking about using different servers to send the mail.

Auguy
Sylvania/Toledo Ohio
 
Sorry, my doubt is in our office we have two different domains, one is within india and other is international one. For each domains we have 2 different mailserver. How can i send email to both domains at a time without sendind seperately for each domain?
 

My post shows how to do that. In an email address, everything after the @ symbol is the domain. To send email to multiple domains, just separate the email address in the list by a semicolon.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
dim lacalmailserver as string="10.10.10.10"
dim to_add as string="abc&india.com;def@international.com"


Dim EmailServer As New System.Net.Mail.SmtpClient(LocalMailServer)
Dim myMessage As New System.Net.Mail.MailMessage(from_add, to_add, mail_subject, mail_body)
EmailServer.Send(myMessage)
myMessage = Nothing

I am using this procedure to send an emial. For @india.com we are using 10.10.10.10(example) and for international we are using 10.10.10.20.

In this context how can i send email to both email id's.
 

You would have to run your code again with the second server address. There is not a way to send email through (not to) multiple email servers at the same time.

And I'm done here.

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top