Showing posts with label sending. Show all posts
Showing posts with label sending. Show all posts

Saturday, March 31, 2012

Sending/Receiving data from remote app

What is the best / easiest way to send small (<1Kb) data packets to a remote application (known IP address) from an ASP.NET driven web site? The remote app will then send a similar reply packet. It is not a database that is being accessed but a custom application that can be modified to receive and send this data.
Anyone done something similar?how is the remote app usually contacted. Does it send back a httpresponse. or is it some service that returns a stream of characters.
HTTPResponse object if it's replying in http
probably SOCKETS if it's returning data ( like telnet)
I have no experience doing this - but hope that points you in right direction

Sendmail config

I've been given the following template code:

// Generic method for sending emails

publicstaticvoid SendMail(string from,string to,string subject,string body)

{

// Configure mail client (may need additional// code for authenticated SMTP servers)SmtpClient mailClient =newSmtpClient

(

GuitarShackConfiguration.MailServer);// Create the mail message//MailMessage mailMessage = new MailMessage(from, to, subject, body);/*

// For SMTP servers that require authentication

message.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", 1);

message.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/sendusername",

"SmtpHostUserName");

message.Fields.Add

("http://schemas.microsoft.com/cdo/configuration/sendpassword",

"SmtpHostPassword");

*/

// Send mail//mailClient.Send(mailMessage);

}

but i can't seem to get it to work with any mailhosts. Could someone kindly show me how to make this work with someone like hotmail or gmail or even a regular pop3 mail provider?

First of all be aware that most of the mail server requires you to authenticate before sending emails. I'v attached a code where you can use to send emails below.


Dim MailObjAs New System.Net.Mail.SmtpClient MailObj.Host ="smtp server goes here"Dim credAs New Net.NetworkCredential("username","password")' authentication MailObj.Credentials = cred MailObj.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.NetworkDim msgAs New System.Net.Mail.MailMessageWith msg .Body ="Body goes here" .From =New System.Net.Mail.MailAddress("from email","from name") .To.Add("destination email address") .Subject ="subject goes here"End With MailObj.Send(msg)


Regards


First of all be aware that most of the mail server requires you to authenticate before sending emails. I'v attached a code where you can use to send emails below.


Dim MailObjAs New System.Net.Mail.SmtpClient
MailObj.Host ="smtp server goes here"
Dim credAs New Net.NetworkCredential("username","password")' authentication
MailObj.Credentials = cred
MailObj.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
Dim msgAs New System.Net.Mail.MailMessage
With msg
.Body ="Body goes here"
.From =New System.Net.Mail.MailAddress("from email","from name")
.To.Add("destination email address")
.Subject ="subject goes here"
End With

MailObj.Send(msg)


Regards


Hi,

Any question about Sending Mail may be answered at this website:

http://www.systemnetmail.com/

Good luck!