web den mail gönderme işleminde hata

Delphi .net ve .net ile ilgili konuları buraya yazabilirsiniz.
Cevapla
kamuran48
Üye
Mesajlar: 284
Kayıt: 29 Eyl 2003 09:27
Konum: muğla

web den mail gönderme işleminde hata

Mesaj gönderen kamuran48 »

selam,

Kod: Tümünü seç

objMail:=MailMessage.Create;
objMail.From :='info@benmsayfam.net';
objMail.&To :=TextBox1.Text;
objMail.Subject :='Merhaba';
objMail.Body:='Sisteme kaydını yapıldı';
objMail.BodyFormat := MailFormat.Text; // MailFormat.Html de olabilir
SmtpMail.SmtpServer := 'mail.benmsayfam.net';
SmtpMail.Send(objMail);
bu kodla web sitemden email göndermeye çalışıyorum .fakat aşağıdaki hatayı alıyorum.iyi çalışmalar.

Server Error in '/' Application.
--------------------------------------------------------------------------------

Aktarim, sunucuya baglanamadi.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.COMException: Aktarim, sunucuya baglanamadi.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[COMException (0x80040213): Aktarim, sunucuya baglanamadi.
]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters) +0
System.RuntimeType.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParameters) +473
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +58

[HttpException (0x80004005): Could not access 'CDO.Message' object.]
System.Web.Mail.LateBoundAccessHelper.CallMethod(Object obj, String methodName, Object[] args) +113
System.Web.Mail.CdoSysHelper.Send(MailMessage message) +1859
System.Web.Mail.SmtpMail.Send(MailMessage message) +153
unuttum.TWebForm1.Button2_Click(Object sender, EventArgs e) in C:\Inetpub\wwwroot\benimsayfam\unuttum.pas:108
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET Version:1.1.4322.2300
Coci06
Üye
Mesajlar: 3
Kayıt: 20 Nis 2006 10:37

Mail Gönderme

Mesaj gönderen Coci06 »

Merhaba birde bunu dene

uses idMessage;

function TfrmMain.SendMail(FileToSend: String): String;
var
MailMsg : TidMessage;
MailFile : TidAttachment;
begin
// attachment la birlikte gönderiyor
MailMsg := TidMessage.Create(idSMTP);
// from
MailMsg.From.Address := 'gondericiadresi@benimsite.com';
MailMsg.From.Name := 'gondericiadı';
MailMsg.Recipients.Add;
MailMsg.Recipients.Items[0].Address := 'gonderilenadres@benimsite.com';
//
// MailMsg.ReplyTo. := GetOption('FromAddress');
MailMsg.Subject := 'Screenshot created on ' +
FormatDateTime('dd.mm.yyyy hh:nn:ss', Now);
// attachment işte burda
MailFile := TidAttachment.Create(MailMsg.MessageParts, FileToSend);
MailFile.DisplayName := MailMsg.Subject;

// server a bağlanıyor
try
idSMTP.Connect();
except
on E : Exception do
Exit;
end;

// gönderiyor
try
idSMTP.Send(MailMsg);
except
on E: Exception do
Exit;
end;
AddToLog('Message sent.', clGreen);

// işlem bitince hafızayı temizliyor.
idSMTP.Disconnect;
MailFile.Free;
MailMsg.Free;
end;
Kullanıcı avatarı
Fatih!
Kıdemli Üye
Mesajlar: 1172
Kayıt: 26 Kas 2004 10:46
Konum: Malatya
İletişim:

Mesaj gönderen Fatih! »

Kod: Tümünü seç

mail.benmsayfam.net
Bu ifade yerine localhost yada sunucunun ip numarasını yazarak deneyin
Cevapla