Bug 8699 - System.net.mail
Summary: System.net.mail
Status: RESOLVED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: BCL Class Libraries ()
Version: 4.2.x
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Radek Doulik
URL:
Depends on:
Blocks:
 
Reported: 2012-11-30 18:43 UTC by Allie Miller
Modified: 2017-06-28 21:30 UTC (History)
5 users (show)

Tags: bb clb
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Allie Miller 2012-11-30 18:43:41 UTC
When running the below code, getting "Unhandled Exception: System.Net.Mail.SmtpException"


> string username = "abc@xyz.com";
> string password = "1234567890";
> System.Net.NetworkCredential nc = new
> System.Net.NetworkCredential(username, password);
> MailMessage MailMessage = new MailMessage();
> MailMessage.To.Add("pqr@xyz.com");
> MailMessage.Subject = "here is the subject";
> MailMessage.From = new System.Net.Mail.MailAddress("abc@xyz.com");
> MailMessage.Body = "Application run time was ";
> System.Net.Mail.SmtpClient SmtpClient = new System.Net.Mail.SmtpClient("
> smtp.gmail.com");
> SmtpClient.UseDefaultCredentials = false;
>
> SmtpClient.EnableSsl = true;
> SmtpClient.Credentials = nc;
> SmtpClient.Port = 587;
> SmtpClient.Send(MailMessage);

Runs fine on Windows.
Running Mono for android 4.2.7
Visual studio 2010
Comment 2 woodyj007 2013-07-08 12:02:57 UTC
I'm also having this issue now.  4.6.8

As bug describes,  works fine from C# on windows but not on Android.  I get the error, "Message could not be sent"

App has internet rights.
Comment 3 Jonathan Pryor 2013-07-08 13:23:57 UTC
@woodyj007: What's the full stack trace of your error?
Comment 4 woodyj007 2013-07-09 03:29:33 UTC
This is what I have in logcat.

I've solved the problem with a workaround.  I pass the details on to my web service and get that to send the email.  The code is identical though.  Works in windows but fails in Android.

--------- beginning of /dev/log/system

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

--------- beginning of /dev/log/main

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-6ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-10ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/PowerManagerService(  573): acquireWakeLock flags=0x1 tag=AlarmManager

D/PowerManagerService(  573): releaseWakeLock flags=0x1 tag=AlarmManager

I/CNE_DEBUG(  573): CNE received action: android.intent.action.BATTERY_CHANGED

I/CNE_DEBUG(  573): UpdateBatteryStatus status=2 pluginType=2 level=100

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

E/OdekakeDcfFile(  284): ERROR[m_pOdekakeDcfDemuxer==NULL]

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 5 

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 1 

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 1 

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 1 

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 1 

W/QComExtractorFactory(18210): Didn't match the sniff <=== status = 1 

E/OdekakeDcfFile(  284): ERROR[m_pOdekakeDcfDemuxer==NULL]

D/MediaPlayer(10849): start() mUri is <URL suppressed>

D/BluetoothA2dpService(  573): uri is <URI SUPPRESSED> mUri is <URI SUPPRESSED>

D/PowerManagerService(  573): acquireWakeLock flags=0x1 tag=AudioOut_2

D/alsa_ucm(18210): snd_use_case_set(): uc_mgr 0x41767db0 identifier _enadev value xLoud Speaker

D/alsa_ucm(18210): snd_use_case_set(): uc_mgr 0x41767db0 identifier _verb value HiFi

D/alsa_ucm(18210): Set mixer controls for xLoud Speaker enable 1

D/alsa_ucm(18210): acdb_id 520 cap 1 enable 1

D/ACDB-LOADER(18210): ACDB -> send_audio_cal, acdb_id = 520, path =  0

D/ACDB-LOADER(18210): ACDB -> send_adm_topology

D/ACDB-LOADER(18210): ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TOPOLOGY_ID

D/ACDB-LOADER(18210): ACDB -> send_audtable

D/ACDB-LOADER(18210): ACDB -> ACDB_CMD_GET_AUDPROC_COMMON_TABLE

D/ACDB-LOADER(18210): ACDB -> AUDIO_SET_AUDPROC_CAL

D/ACDB-LOADER(18210): ACDB -> send_audvoltable

D/ACDB-LOADER(18210): ACDB -> ACDB_CMD_GET_AUDPROC_GAIN_DEP_VOLTBL_STEP_COPP

D/ACDB-LOADER(18210): ACDB -> AUDIO_SET_AUDPROC_VOL_CAL

D/ACDB-LOADER(18210): ACDB -> AUDIO_SET_AFE_CAL

D/alsa_ucm(18210): Setting mixer control: SLIM_0_RX Channels, value: Two

D/alsa_ucm(18210): Setting mixer control: RX5 MIX1 INP1, value: RX1

E/SQLiteLog(10849): (1) statement aborts at 2: [ROLLBACK] cannot rollback - no transaction is active

D/alsa_ucm(18210): Setting mixer control: RX3 MIX1 INP1, value: RX2

D/alsa_ucm(18210): Setting mixer control: RX4 DSM MUX, value: DSM_INV

D/alsa_ucm(18210): Setting mixer control: RX6 DSM MUX, value: DSM_INV

D/alsa_ucm(18210): Setting mixer control: LINEOUT1 Volume, value: 100

D/alsa_ucm(18210): Setting mixer control: LINEOUT2 Volume, value: 100

D/alsa_ucm(18210): Setting mixer control: LINEOUT3 Volume, value: 100

D/alsa_ucm(18210): Setting mixer control: LINEOUT4 Volume, value: 100

D/alsa_ucm(18210): Setting mixer control: SLIM TX3 MUX, value: RMIX5

D/alsa_ucm(18210): Setting mixer control: SLIM TX5 MUX, value: RMIX3

D/alsa_ucm(18210): Setting mixer control: RX3 Digital Volume, value: 68

D/alsa_ucm(18210): Setting mixer control: RX4 Digital Volume, value: 68

D/alsa_ucm(18210): Setting mixer control: RX5 Digital Volume, value: 68

D/alsa_ucm(18210): Setting mixer control: RX6 Digital Volume, value: 68

D/alsa_ucm(18210): Set mixer controls for HiFi enable 1

D/alsa_ucm(18210): Setting mixer control: SLIMBUS_0_RX Audio Mixer MultiMedia1, value: 1

E/SQLiteLog(10849): (1) statement aborts at 2: [ROLLBACK] cannot rollback - no transaction is active

I/ASMobile(10849): cGlobal CreateWebService

D/dalvikvm(10849): WAIT_FOR_CONCURRENT_GC blocked 0ms

D/dalvikvm(10849): GC_EXPLICIT freed 145K, 18% free 14062K/17027K, paused 1ms+5ms, total 29ms

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-2ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-4ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-6ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-8ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-7ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-10ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

I/Choreographer(10849): Skipped 494 frames!  The application may be doing too much work on its main thread.

D/PowerManagerService(  573): acquireWakeLock flags=0x2000000a tag=KEEP_SCREEN_ON_FLAG

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-8ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-14ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/PowerManagerService(  573): releaseWakeLock flags=0x2000000a tag=KEEP_SCREEN_ON_FLAG

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-5ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-13ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-5ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-10ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StateMachine(  573): handleMessage: E msg.what=131155

D/StateMachine(  573): processMsg: ConnectedState

D/WifiStateMachine(  573): ConnectedState{ what=131155 when=-5ms arg1=611 }

D/StateMachine(  573): processMsg: L2ConnectedState

D/WifiStateMachine(  573): L2ConnectedState{ what=131155 when=-10ms arg1=611 }

D/StateMachine(  573): handleMessage: X

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon

D/StatusBar.NetworkController(  731): refreshViews: Data not connected!! Set no data type icon
Comment 5 Cody Beyer (MSFT) 2017-06-28 21:30:10 UTC
everything works fine for me in testing. I believe this issue is resolved in current versions of Xamarin.Android