问题
JvMail component is not functioning right or I am messing something up.
procedure TForm1.RzURLLabel1Click(Sender: TObject);
begin
if cxLookUpComboBox1.Text ='' then
abort else
with JvMail1.SimpleMAPI do
begin
JvMail1.Clear;
JvMail1.Recipient.AddRecipient('smtp:mymail@gmail.com');
JvMail1.Subject := 'Password lost ';
JvMail1.Body.Text := 'Request password :' +#13#10+ cxLookUpComboBox1.Text +#13#10+ AdvOfficeStatusBar1.Panels[4].Text ;
JvMail1.SendMail;
end
end;
My mail does not get sent unless I put the prefix 'smtp:' infront of the mail adress. Any ideas on how to fix this ?
回答1:
The documentation is clear to that
Notes:
The format of an address specified by parameter Address is [address type][e-mail address]. Examples of valid addresses are FAX:206-555-1212 and SMTP:M@X.COM.
Description:
The following code adds a recipient to the Recipient list:
JvMail1.Recipient.AddRecipient('SMTP:someone@somedomain.com', 'Some one');
回答2:
I don't provide any other solution or awesome in depth explanation on why you need to add smtp, so feel free to downvote this answer. :)
You already have a workaround, so instead I'll give some real world advice on how to fix this:
- Just prepend the damn
smtp:
via code if that's what it takes - Write a TODO comment that says you need to figure out what's going on here
- Move on to your next task
Of course, unless sending email is really at the core of your application, or if you really have nothing better to do.
来源:https://stackoverflow.com/questions/23304163/jvmail-jedi-component-not-sending-mail