## Sending email messages

Please discuss general Delphi programming topics here.

### Sending email messages

Hello!
I am using this: http://delphi.about.com/od/internetintr ... 20304a.htm to make my own emailer. But the problem is that almost every SMTP need to autenciate(spell?). Like gmail or hotmail it will give me acces violation if I'm not using the right password and username.
I have found SMTP.Password and SMTP.Username. But when i but the correct options there it still gives me acces violation. Somebody have an answer at my problem. Were to fill in the User/password.
Btw, it's on SMTP.Send(MailMessage); it gives me acces violation.

/Thanks
Gullb3rg
Member

Posts: 4
Joined: October 26th, 2006, 3:31 pm

Are you sure you use the right stuff for it? you know, newest stuff... old indy had such problems. also did you simply copy& paste the code from site or have you worked on your own? have3 you read the documentation right? does the demo work fine? man, there are many more questions, and just one request: by sole description without a code we know shit about what's happening because there are at least 20 ways to do any stuff to do same thing.
Johnny_Bit
VIP Member

Posts: 455
Joined: June 15th, 2003, 9:56 am

The demo doesn't work either. And i have done it myself and haven't copy&paste, and i have read the doc many times. Here is the code:
Code: Select all
procedure TForm1.SendClick(Sender: TObject);begin  SMTP.Host := edHost.Text;  SMTP.Port := 25;  Mail.Recipients.EMailAddresses := edTo.Text;  Mail.From.Address := edFrom.Text;  Mail.Subject := edSubject.Text;  Mail.Body.Text := richMessage.Text;  if FileExists(edAttatch.Text) Then    TIdAttachment.Create(Mail.MessageParts, edAttatch.Text);  Try    SMTP.Connect(1000);    SMTP.Send(Mail);  Finally    if SMTP.Connected Then      SMTP.Disconnect;  end;end;
Gullb3rg
Member

Posts: 4
Joined: October 26th, 2006, 3:31 pm

have you tried service manually?
Johnny_Bit
VIP Member

Posts: 455
Joined: June 15th, 2003, 9:56 am

### smtp port...

Have you tried changing the port from 25? I think both yahoo and gmail use a different port. You will be able to get this information from their sites.

The other thing to consider is the authentication type for which information will be available on their sites.

I also recall that yahoo did not allow smtp (this can be confirmed on their web site).

Cheers
Elliot
eashton
Active Member

Posts: 8
Joined: January 24th, 2007, 7:16 pm