안녕하세요 저는 wpf 앱으로 이메일을 보내려고 노력 중입니다. 내가 내 XAML 코드 뒤에 코드에서wpf로 이메일 보내기
<Grid>
<Button Style="{DynamicResource ShowcaseRedBtn}" CommandParameter="[email protected]" Tag="Send Email" Content="Button" Height="23" HorizontalAlignment="Left" Margin="351,186,0,0" Name="button1" VerticalAlignment="Top" Width="140" Click="button1_Click" />
<TextBox Height="23" HorizontalAlignment="Left" Margin="92,70,0,0" Name="txtSubject" VerticalAlignment="Top" Width="234" />
<TextBox AcceptsReturn="True" AcceptsTab="True" Height="159" HorizontalAlignment="Left" Margin="92,121,0,0" Name="txtBody" VerticalAlignment="Top" Width="234" />
</Grid>
여기에 보여
private void button1_Click(object sender, RoutedEventArgs e)
{
Button btn = sender as Button;
if (btn == null)
return;
string url = btn.CommandParameter as string;
if (String.IsNullOrEmpty(url))
return;
try
{
// here i wish set the parameters of email in this way
// 1. mailto = url;
// 2. subject = txtSubject.Text;
// 3. body = txtBody.Text;
Process.Start("mailto:[email protected]?subject=Software&body=test ");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
내 목적은 양식에서 데이터를 바인딩 이메일의 매개 변수를 설정
: // 1. 흔한 = url; // 2. subject = txtSubject.Text; // 3. body = txtBody.Text;
이 단계를 수행하는 방법에 대해 알고 있습니까?
감사합니다.
건배
Process.Start를()에 대한 URL이 열립니다 사용자 메일 클라이언트에 새로운 미리 채워진 메시지가 있습니다. 너가 원하는게 그거야 ? 또는 버튼을 눌렀을 때 실제로 메일을 보내시겠습니까? – JYL